Description
Update: @shubheksha will be working on this. Please coordinate with her on specific parts you want to help with.
Now that it's stage 3 we can add it.
We should also add relevant documentation (add a "Code Splitting" section to User Guide).
Since we use Webpack 1.x for now, I think we need https://github.com/airbnb/babel-plugin-dynamic-import-webpack but I'm not entirely sure.
TODO items here:
- Figure out which Babel plugin implements current version of https://github.com/tc39/proposal-dynamic-import and compiles down to
require.ensure
. - Add said Babel plugin to
babel-preset-react-app
. - Figure out what should happen in the test environment. Probably need to add some sort of a fallback that turns it into
Promise.resolve(require(moduleName))
. - Add documentation about using code splitting.
- Ship it!
Let us know if you want to help. I won't have time to work on this.
Please leave a comment below if you want to work on this. If somebody is already working on it, please offer to collaborate with them if you like. Don't try to "be there first" if somebody is already working on some part of this. Please collaborate in this issue and split responsibilities.
I'm excited about finally having a way to code split JS code without Webpack-specific syntax!
And when we switch to Webpack 2, we'll change to a different plugin (or maybe won't need it at all?)