Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

I do not see the vender.js file in your online webside,how did u do this; because of webpack 2 (the tree shaking)? #63

Closed
aymonYU opened this issue Jun 15, 2017 · 1 comment

Comments

@aymonYU
Copy link

aymonYU commented Jun 15, 2017

I do not see the vender.js file in your online webside,how did u do this; because of webpack 2 (the tree shaking)?

@grgur
Copy link
Member

grgur commented Jun 16, 2017

a specific vendor chunk wasn't created for this application. Here's why:

Vendors are embedded in the application core (entry)

There is a set of dependencies - code and libraries - needed to run this (or any other) app successfully. We let webpack figure out what that is.

All routes use code-splitting so they are in separate chunks. Whatever is not a separate chunk is application core.

Vendor chunks don't benefit from tree shaking

When you specify a vendor in a vendor chunk, then the entire package is bundled. E.g. if you reference react-router in vendors.js, then the entire package will be there. But if you let webpack figure out which modules to bundle automatically, it will leverage tree shaking and remove unused code'

Code used in multiple async chunks is extracted

To prevent duplication of code, we set CommonChunksPlugin to extract code used in two or more routes (async chunks) into a separate chunk. This is another alternative to decoupling vendors into a dedicated chunk

@grgur grgur closed this as completed Jun 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants