-
Notifications
You must be signed in to change notification settings - Fork 29
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
refactor(mc-scripts): manually group some vendor chunks #3615
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f7ffaf3
refactor(mc-scripts): manually group some vendor chunks
tylermorrisford b55c4c6
fix(manual-chunks): add vite bundle analyzer
tylermorrisford bad24f8
fix(manual-chunks): include lockfile
tylermorrisford 25a30bc
refactor(mc-scripts): add new vite visualizer plugin
CarlosCortizasCT 1c77000
refactor(mc-scripts): try different manual chunks approach
CarlosCortizasCT 4c27dad
fix(mc-scripts): fix dependency
CarlosCortizasCT 2005f25
refactor(mc-scripts): remove vite builder debugging code
CarlosCortizasCT ff1069d
Merge branch 'main' into nm-manually-group-vendor-chunks
CarlosCortizasCT c793e3b
chore: add changeset
CarlosCortizasCT 8df0afc
chore: remove unnecessary changeset
CarlosCortizasCT f8f062c
refactor(mc-scripts): renaming vars
CarlosCortizasCT ce14413
Merge branch 'main' into nm-manually-group-vendor-chunks
CarlosCortizasCT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@commercetools-frontend/mc-scripts': patch | ||
--- | ||
|
||
Manually group some vendor chunks. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Dependencies to be split/grouped into separate chunks. | ||
// This is useful to reduce the main bundle size and have more | ||
// dedicated caching strategy for specific chunks. | ||
// https://webpack.js.org/plugins/split-chunks-plugin/ | ||
// https://rollupjs.org/configuration-options/#output-manualchunks | ||
const manualChunks = { | ||
'apollo-client': ['@apollo/client'], | ||
'core-js-pure': ['core-js-pure'], | ||
'commercetools-uikit-icons': ['@commercetools-uikit/icons'], | ||
moment: ['moment', 'moment-timezone'], | ||
react: [ | ||
'react', | ||
'react-dom', | ||
'react-router', | ||
'react-router-dom', | ||
'react-intl', | ||
'@reduxjs/toolkit', | ||
'redux', | ||
'react-redux', | ||
'redux-logger', | ||
'redux-thunk', | ||
], | ||
'sentry-browser': ['@sentry/browser'], | ||
}; | ||
|
||
const webpackCacheGroups = Object.entries(manualChunks).reduce( | ||
(previousChunks, [chunkName, vendors]) => { | ||
return { | ||
...previousChunks, | ||
[chunkName]: { | ||
test: new RegExp(`[\\/]node_modules[\\/](${vendors.join('|')})[\\/]`), | ||
name: chunkName, | ||
chunks: 'all', | ||
}, | ||
}; | ||
}, | ||
{} | ||
); | ||
|
||
export { manualChunks, webpackCacheGroups }; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emmenko the only change I made is to lump redux and react together; since redux is fairly small this seems fine to do.