-
-
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
[docs] Clarify when bundle size optimization is needed #36823
[docs] Clarify when bundle size optimization is needed #36823
Conversation
d09019a
to
e2d5cbd
Compare
@@ -4,23 +4,25 @@ | |||
|
|||
## Bundle size matters | |||
|
|||
The bundle size of MUI is taken very seriously. Size snapshots are taken | |||
MUI takes the bundle size very seriously. Size snapshots are taken |
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.
MUI isn't a product
MUI exposes its full API on the top-level `@mui` imports. | ||
If you're using ES6 modules and a bundler that supports tree-shaking ([`webpack` >= 2.x](https://webpack.js.org/guides/tree-shaking/), [`parcel` with a flag](https://en.parceljs.org/cli.html#enable-experimental-scope-hoisting/tree-shaking-support)) you can safely use named imports and still get an optimized bundle size automatically: | ||
If you're using ES6 modules and a bundler that supports tree-shaking ([`webpack` >= 2.x](https://webpack.js.org/guides/tree-shaking/), [`parcel` with a flag](https://en.parceljs.org/cli.html#enable-experimental-scope-hoisting/tree-shaking-support)) you can safely use named imports and still get an optimized bundle size automatically in **production**: |
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.
This is so often overlooked.
|
||
```js | ||
import { Button, TextField } from '@mui/material'; | ||
``` | ||
|
||
⚠️ The following instructions are only needed if you want to optimize your development startup times or if you are using an older bundler |
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.
Use the convention for warnings.
+ "start": "react-app-rewired start", | ||
+ "build": "react-app-rewired build", | ||
+ "test": "react-app-rewired test", |
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.
This is the correct git diff output.
@@ -210,10 +212,20 @@ It will perform the following diffs: | |||
## Available bundles |
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.
I got so confused about this section, it should be clearer now.
Netlify deploy previewBundle size report |
e2d5cbd
to
6753134
Compare
Clarify this confusion https://mui-org.slack.com/archives/C041SDSF32L/p1680655322928259
Preview: https://deploy-preview-36823--material-ui.netlify.app/material-ui/guides/minimizing-bundle-size/