-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Use webpack dll plugin for faster rebuilds #1651
Conversation
@viankakrisna Just curious, what kind of speedup do you see using this method? |
@tbillington here's the numbers, i've not yet done repeated test, but it should gave you the gist:
Will update more when i have done repeated test. In general, it improves the warm build significantly. |
Also, the build size is not optimized, it's only reading from package json. So if you have lodash there, you will get full lodash in the build. There are no optimization except minifying happening in here T.T. I haven't found other ways to do it though, happy to get input from all the webpack master 😄 UPDATE: it uses a vendor entry point right now so we don't end up with full lodash on dll when it is listed as dependencies |
Should this be used for the production build as well? Normally I've seen DLL in dev and CommonChunk plugin for the production build. Example here: https://github.com/react-boilerplate/react-boilerplate |
This is an interesting direction, but seems very complex to me. I don’t think this is something we’d want to leave users with after they eject. |
@gaearon well, this is just a proof of concept, i don't mind if it doesn't end up released. Just curious exploring what the sane defaults are 😄 @ekosz from this https://robertknight.github.io/posts/webpack-dll-plugins/
My focus here is the build time. It's frustrating to wait for it to finish in large project. Especially if there's a critical bugfix in production. I'm thinking that this feature could be an opt in, for users that have grown their project and wanted to have fast iteration. From my personal experience, a lot of developers turned off from using module bundlers because they are concerned about the build times and configuration. I think create react app already did a good job in configuring the sane defaults for newcomers, and if we can optimize it to be blazing fast when the user scale, it would make the tool more appealing. And of course, this is just my opinion. Open to suggestion and feedbacks :) |
renamed entry point to index.dll.js to be explicit. |
@viankakrisna Great PR ! Been following from a few days. Love that this is opt-in. I've always been trying to hack together something similar to improve build times, every time that I've been making SPAs from a while now (gulp, webpack etc), and have always created a separate DLL/file for dependencies which don't change between builds. A caveat of doing is is always almost larger bundle sizes shipped, and losing benefits of tree-shaking and modules. For example, (most common use case here) one would be tempted to import even a modular library like I think it should always be documented the pros and cons of using DLLs / vendor bundles. Would love to know your thoughts. cc @gaearon |
@vikrantpogula Thanks! Yeah, we need a proper docs for this feature, especially for the un-tree-shakable dll. Wanna help? 😃 @gaearon After reading https://medium.com/making-internets/webpack-configuration-done-right-86c325a6927f , I've been thinking maybe we should have a internal hook for composing webpack config, |
@viankakrisna sure will work on it. upon further research it looks like tree-shaking is still broken (not stable ?) in webpack 2. ref: webpack/webpack#2867 Ill try this PR in a sample repository and get back how it goes, but I can only in the weekend or next week ! |
@vikrantpogula yeah, I mean dead code elimination etc which is impossible because it's a different build altogether. Please do! Appreciate the help. :) |
closing this for #2710 |
POC for #913
currently, it uses
node_modules/.cache/dll
for storing cached vendor builds and addsrc/index.dll.js
entry point for requiring dependencies. It also hashes the filenames so it is safe to use in production.Todos: