Closed fregante closed 7 years ago
Even if you only have one entry, a vendor.js
is still a good thing to have. The idea is that your vendor.js
changes very infrequently while your app.js
changes often, so subsequent visits of users should not bog them down with a 300kb re-download (or whatever).
Oh btw, #1 has a very good solution involving CommonChunksPlugin
:-)
Yes but how do you track those changes? Webpack still rebuilds that file and its modified time changes. While you think it's not being downloaded, it most likely still is.
Just having it there is not enough to ensure that it saves bandwidth and if anything it worsens performance since now there are two requests to be made and gzip can't be applied to both at once.
Webpack still rebuilds that file and its modified time changes.
The final built file will still be identical to the previous one. Assuming you have a sane asset deployment/serving pipeline (fingerprints, CDN, ETags, etc), it should result in the same fingerprint for the asset in production. Hence, users shouldn't need to re-download them.
now there are two requests
This is actually a good thing—it means they can be fetched in parallel (especially in production).
Why have a separate file for vendor.js in webpack land? Isn't
CommonsChunkPlugin
enough, when multiple entries are needed?