-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[core] Improve tree-shakeability #13391
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
8fab7b2
[core] Add full esmodules build
eps1lon e5653d7
[core] Add support for yarn workspaces run
eps1lon 3edfadb
Revert "[core] Add support for yarn workspaces run"
eps1lon 2ae7710
[core] Update size-limit
eps1lon 39c1783
[core] esnext -> es
eps1lon d2d9276
Merge branch 'next' into feat/improve-tree-shaking-v2
eps1lon cdd1691
[core] Fix incorrect bundle sizes from merge
eps1lon 7f39bc0
[core] Normalize build process
eps1lon 6edcfb3
[core] sort scripts alphanumberic
eps1lon 2db6dad
[core] Add size test for esm build
eps1lon 13cfba8
[core] Fix unresolved module entry
eps1lon de3e205
[core] revert size limit changes for cjs build
eps1lon 5296982
[core] Fix increased size limit
eps1lon c1ff40a
[core] update size limits
eps1lon c3d0fdc
[core] Normalize build scripts in icons and docs
eps1lon 2d13089
Merge branch 'next' into feat/improve-tree-shaking-v2
eps1lon c3a65d4
fix size limit
eps1lon 5717dca
fix utils build
eps1lon aa4bb78
[docs] fix build
eps1lon 401dcd5
Merge branch 'next' into feat/improve-tree-shaking-v2
eps1lon d70e5bd
[core] Reduce size tolerance
eps1lon 831a807
[core] Remove unnecessary array spread
eps1lon 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
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ if (process.env.BABEL_ENV === 'es') { | |
[ | ||
'@babel/preset-env', | ||
{ | ||
modules: ['modules', 'production-umd'].includes(process.env.BABEL_ENV) ? false : 'commonjs', | ||
modules: ['esm', 'production-umd'].includes(process.env.BABEL_ENV) ? false : 'commonjs', | ||
}, | ||
], | ||
]; | ||
|
@@ -36,6 +36,18 @@ const defaultAlias = { | |
'@material-ui/system': './packages/material-ui-system/src', | ||
}; | ||
|
||
const productionPlugins = [ | ||
'transform-react-constant-elements', | ||
'transform-dev-warning', | ||
['react-remove-properties', { properties: ['data-mui-test'] }], | ||
[ | ||
'transform-react-remove-prop-types', | ||
{ | ||
mode: 'unsafe-wrap', | ||
}, | ||
], | ||
]; | ||
|
||
module.exports = { | ||
presets: defaultPresets.concat(['@babel/preset-react']), | ||
plugins: [ | ||
|
@@ -46,17 +58,8 @@ module.exports = { | |
], | ||
ignore: [/@babel[\\|/]runtime/], | ||
env: { | ||
test: { | ||
sourceMaps: 'both', | ||
plugins: [ | ||
[ | ||
'babel-plugin-module-resolver', | ||
{ | ||
root: ['./'], | ||
alias: defaultAlias, | ||
}, | ||
], | ||
], | ||
cjs: { | ||
plugins: productionPlugins, | ||
}, | ||
coverage: { | ||
plugins: [ | ||
|
@@ -124,47 +127,26 @@ module.exports = { | |
['transform-react-remove-prop-types', { mode: 'remove' }], | ||
], | ||
}, | ||
esm: { | ||
plugins: productionPlugins, | ||
}, | ||
es: { | ||
plugins: [ | ||
'transform-react-constant-elements', | ||
'transform-dev-warning', | ||
['react-remove-properties', { properties: ['data-mui-test'] }], | ||
[ | ||
'transform-react-remove-prop-types', | ||
{ | ||
mode: 'unsafe-wrap', | ||
}, | ||
], | ||
], | ||
// It's most likely a babel bug. | ||
// We are using this ignore option in the CLI command but that has no effect. | ||
ignore: ['**/*.test.js'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was used in the cli with |
||
plugins: productionPlugins, | ||
}, | ||
production: { | ||
plugins: [ | ||
'transform-react-constant-elements', | ||
'transform-dev-warning', | ||
['react-remove-properties', { properties: ['data-mui-test'] }], | ||
[ | ||
'transform-react-remove-prop-types', | ||
{ | ||
mode: 'unsafe-wrap', | ||
}, | ||
], | ||
], | ||
// It's most likely a babel bug. | ||
// We are using this ignore option in the CLI command but that has no effect. | ||
ignore: ['**/*.test.js'], | ||
plugins: productionPlugins, | ||
}, | ||
'production-umd': { | ||
plugins: productionPlugins, | ||
}, | ||
test: { | ||
sourceMaps: 'both', | ||
plugins: [ | ||
'transform-react-constant-elements', | ||
'transform-dev-warning', | ||
['react-remove-properties', { properties: ['data-mui-test'] }], | ||
[ | ||
'transform-react-remove-prop-types', | ||
'babel-plugin-module-resolver', | ||
{ | ||
mode: 'unsafe-wrap', | ||
root: ['./'], | ||
alias: defaultAlias, | ||
}, | ||
], | ||
], | ||
|
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
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
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
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.