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

Support for code splitting? #560

Closed
rossta opened this issue Jul 10, 2017 · 5 comments
Closed

Support for code splitting? #560

rossta opened this issue Jul 10, 2017 · 5 comments

Comments

@rossta
Copy link
Member

rossta commented Jul 10, 2017

I wanted to open the discussion as to whether the default Webpacker configuration should take a stance on code-splitting, which can yield better build times and improved caching. There appear to be a few popular approaches, including using the CommonsChunkPlugin and the DllPlugin+DllReferencePlugin. The "Dll" approach appears to be more powerful but would impact the design of current Webpacker config more significantly.

Thoughts?

@gauravtiwari
Copy link
Member

@rossta Hey, thanks for opening the discussion here. I have been thinking about chunking setup but didn't arrive to any final conclusion, mainly because of the varied use cases and probably this might make usage bit confusing i.e. adding an extra vendor file along with the pack file. At the moment common chunk setup lives in the Readme and there is no documentation on using DLL plugin. Perhaps we just document the usage? What do you think?

@rossta
Copy link
Member Author

rossta commented Jul 18, 2017

@javan Thanks for your thoughts. I can see your point about varied use cases and possible confusion. We're trying to evaluate how best to maintain our Webpack js config files as we add functionality and our config starts to diverge from the Webpacker generated config through gem version upgrades. For now, documentation and careful merges seem the simplest path forward. I'd be happy to submit README documentation if we decide to go ahead with the DLL plugin to support code splitting in our app.

@rossta rossta closed this as completed Jul 18, 2017
@lucaspiller
Copy link

I apologise for reviving a dead issue, but @rossta did you find any solutions that work well with Webpacker? Our application has grown, and it now takes around 90s for a complete rebuild, so we would like to split up the build process.

@rossta
Copy link
Member Author

rossta commented Oct 5, 2017

@lucaspiller We're currently using the CommonsChunkPlugin similar to what's documented in Webpacker. We haven't yet investigated the DLL plugin, but there was some discussion in #702 that may be helpful. No experience yet either with any async or on demand loading.

@justin808
Copy link
Contributor

justin808 commented Jul 17, 2018

Any updates to this issue? I've got code splitting working for egghead.io with server-side rendering and Rails (Webpack v4, react-loadable, react-router v4). We're only using rails/webpacker for the view helpers. What's amazing about the code splitting is how the JS code knows just what JS and CS to load. So you don't have to put in the script tags for the used bundles. The setup uses React on Rails, including rails/webpacker.

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

4 participants