feat(v2): better webpack splitchunks optimization#1565
Merged
Conversation
Contributor
|
Deploy preview for docusaurus-2 ready! Built with commit 7df44b6 |
Contributor
|
Deploy preview for docusaurus-preview ready! Built with commit 7df44b6 |
4895e04 to
a1be1a8
Compare
yangshun
approved these changes
Jun 5, 2019
…endiliey/splitchunks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This PR is optimizing webpack splitchunks algorithm.
I notice that the react-live is not being lazily loaded properly due to our chunking algorithm. It tries to put vendors all into one folder.
The simple idea is this. For bigger node_modules package, try to split it out into a separate chunk
Consider this scenario
Previously
will result in a.bundle.js, b.bundle.js and
vendors.js(containing both react, endi and react-live)So if i load a.bundle.js, it will also load vendors.js. Note that react-live is not needed but i had to load it too
If i load b.bundle.js, it will load vendors.js
This "PR
Which will result in a.bundle.js, b.bundle.js and
vendors.js(containing both react and endi) andreact-live.jsSo if i load a.bundle.js, it will only load vendors.js.
If i load b.bundle.js, it will load vendors.js and react-live.js
Our first page load performance is definitely better.
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
before


after


overall bundle size has no change.
Due to browsers parallel request capability, this is definitely better.