Open dalebaldwin opened 7 years ago
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.
I looked through the change log and I think it's been merged. Will see if I can get it working today.
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.
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.
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.
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.
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?