-
Notifications
You must be signed in to change notification settings - Fork 249
Use webpack DLL plugin for performance improvement #532
Comments
Just run the build of the dll in npm postinstall hook. Should be good right? Here are some ressources: |
I set this up for a project and it cut the build time in half. Where would this be implemented in the project? In the boilerplate? |
Could you inject it in the core? We want to keep the changes in boilerplate as small as possible. See config.*.js in this folder https://github.com/MoOx/phenomic/tree/master/src/builder/webpack |
@DavidWells can you show us a diff as an example so I can investigate this a little? |
@MoOx this is how I hooked it up: https://gist.github.com/DavidWells/e886bff1fdb543a707b39451535b1369 |
Webpack.config.dll.js https://gist.github.com/DavidWells/e886bff1fdb543a707b39451535b1369#file-webpack-dll-config-js gets run from the npm Then in the index.html file you include the vendorPackages.dll.js which has all the non frequently changing files https://gist.github.com/DavidWells/e886bff1fdb543a707b39451535b1369#file-index-html-L7 And the last piece is providing the manifest to your development config: https://gist.github.com/DavidWells/e886bff1fdb543a707b39451535b1369#file-webpack-dev-config-js-L31-L33 |
I implemented this, but the bad part is that enabling this seems to disable hard source plugin (which is far better than dll). I opened an issue so I hope we could benefit from hard source AND dllplugin at the same time. mzgoddard/hard-source-webpack-plugin#18 Meanwhile I will ship the hard source option (eg: 20s to 4s for the docs). |
Compared to the cache we have (easy to setup, just a flag) dll will be a pain so closing since I don't plan to spend more time on this and nobody really asked for this. |
Looks like @mzgoddard is working on this! mzgoddard/hard-source-webpack-plugin#18 🎉 I have a DLL setup ready to go once hard-source gets updated. It should speed up hot-module reloading quite a bit =) |
The problem I see is: how we decide what dep to put in the dll bundle? |
all dev deps https://github.com/serverless/site/blob/master/webpack.DLL.babel.js#L14 Then you need to generate the DLL on the postinstall npm hook to update the DLL everytime |
As long as the hard-source plugin gets updated and allows for DLL. People can do this in userland. I'm cool with that =) |
I am afraid that dev deps can be quickly too much. Importing babel, webpack etc seems like overkill. I will update the package but I am not sure we can by default use dll plugin. |
just adding react and react-dom would speed up the webpack compilation time for faster |
Going to be fixed with #925 (moving to user-land) |
Especially make sense as webpack won't be a core piece. |
@DavidWells About using a DLL plugin for "all dev deps" as you described.. Should they still be included because they are part of the dependency tree? Edit: A naive test I just did suggests one should add indirect dependencies by hand. |
@loopmode from my experience (& if my memory is correct), it will automatically handle deps of deps. |
@MoOx I haven't done benchmarks of any kind yet, but as I said, it did make quite a difference in bundle size when I manually included them. But also as I said, it was quite a naive quick shot. I do not know whether, for example, most of these lodash dependencies I was seeing were coming from devDependencies like webpack loaders etc, or actual frontend runtime dependencies. In case I find out something useful, I'll post it here. |
I read a new article on using DLL plugin to speed up Webpack initial build speed.
You can read it here : https://medium.com/@soederpop/webpack-plugins-been-we-been-keepin-on-the-dll-cdfdd6cb8cd7#.9fzlbqz0m
It's quite simple to implement (I think). But the problem is how can we detect if the user changed the dependencies to remove the old cache and build a new one ?
The text was updated successfully, but these errors were encountered: