Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Code Splitting to work #34

Open
dalebaldwin opened this issue Aug 7, 2017 · 6 comments
Open

Getting Code Splitting to work #34

dalebaldwin opened this issue Aug 7, 2017 · 6 comments

Comments

@dalebaldwin
Copy link

dalebaldwin commented Aug 7, 2017

Possible just a feature request if you have time (I'll put a pull request if I work it out) but this one has me a bit stuck and I'm still a bit of newbie with React. I'm trying to get code splitting to work on routes but can't find documentation that works with and the webpack 3.4.1 instructions don't work for me either.

My current guess is that node can't work with the newer import() operator. If I switch it out to require() I can get the server to start up. If I then switch it over to import() it will generate the files so I know webpack is at least working with it but then Node will error out.

Any ideas?

@sekoyo
Copy link
Owner

sekoyo commented Aug 7, 2017

I've only done it with client-side projects so you might be right, just a few days ago a contributor to webpack made a blog saying he is able to achieve the first real code splitting universally (it's merged into webpack but not released yet): https://medium.com/faceyspacey/announcing-react-universal-component-2-0-babel-plugin-universal-import-5702d59ec1f4

At some point I'd like to look into that and maybe make an overhaul of this project using what is mentioned there.

@dalebaldwin
Copy link
Author

I looked through the change log and I think it's been merged. Will see if I can get it working today.

@dalebaldwin
Copy link
Author

Looks like the required code has been added to webpack it just hasn't made it over to NPM yet. Will try and get it working once it comes out.

@dalebaldwin
Copy link
Author

Got it working on my fork https://github.com/quantumninja/universal-react but there is an issue with code flashing up so working on fixing that next.

@sekoyo
Copy link
Owner

sekoyo commented Aug 8, 2017

Nice! I'll have a look at this when I've got some time. Saw your post on the universal github page, yep probably a good idea to see if you can build something off of that one and see if you have the same issue. I was thinking about doing a major refactor on this to more closely reflect the example from that blog too.

@dalebaldwin
Copy link
Author

I started on it but haven't had any luck getting it to work with your repo yet. I've gone back and am trying to build from scratch at the moment. The number of interacting elements on this really doesn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants