Skip to content

Commit 18e065d

Browse files
[code-infra] Remove modern bundles (#45808)
Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com> Co-authored-by: Sam Sycamore <71297412+mapache-salvaje@users.noreply.github.com>
1 parent 204e1ca commit 18e065d

File tree

19 files changed

+37
-123
lines changed

19 files changed

+37
-123
lines changed

.browserslistrc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
[modern]
2-
last 1 chrome version
3-
last 1 edge version
4-
last 1 firefox version
5-
last 1 safari version
6-
node 14
7-
81
# Default/Fallback
92
# `npx browserslist --mobile-to-desktop "> 0.5%, last 2 versions, Firefox ESR, not dead, safari >= 15.4, iOS >= 15.4"` when the last major is released.
103
# Explicit safari versions are here based on the agreed terms in: https://github.com/mui/material-ui/issues/40958#issuecomment-1953215043

babel.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function resolveAliasPath(relativeToBabelConf) {
1919

2020
/** @type {babel.ConfigFunction} */
2121
module.exports = function getBabelConfig(api) {
22-
const useESModules = api.env(['regressions', 'modern', 'stable']);
22+
const useESModules = api.env(['regressions', 'stable']);
2323

2424
const defaultAlias = {
2525
'@mui/material': resolveAliasPath('./packages/mui-material/src'),
@@ -50,7 +50,6 @@ module.exports = function getBabelConfig(api) {
5050
browserslistEnv: api.env() || process.env.NODE_ENV,
5151
debug: process.env.MUI_BUILD_VERBOSE === 'true',
5252
modules: useESModules ? false : 'commonjs',
53-
shippedProposals: api.env('modern'),
5453
},
5554
],
5655
[

docs/data/material/guides/minimizing-bundle-size/minimizing-bundle-size.md

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -198,52 +198,3 @@ It will perform the following diffs:
198198
-import TextField from '@mui/material/TextField';
199199
+import { Button, TextField } from '@mui/material';
200200
```
201-
202-
## Available bundles
203-
204-
### Default bundle
205-
206-
The packages published on npm are **transpiled** with [Babel](https://github.com/babel/babel), optimized for performance with the [supported platforms](/material-ui/getting-started/supported-platforms/).
207-
208-
A [modern bundle](#modern-bundle) is also available.
209-
210-
### How to use custom bundles?
211-
212-
:::error
213-
You are strongly discouraged to:
214-
215-
- Import from any of the custom bundles directly. Do not do this:
216-
217-
```js
218-
import { Button } from '@mui/material/modern';
219-
```
220-
221-
You have no guarantee that the dependencies use the `modern` bundle, leading to module duplication in your JavaScript files.
222-
223-
- Import from any of the undocumented files or folders. Do not do this:
224-
225-
```js
226-
import { Button } from '@mui/material/esm';
227-
```
228-
229-
You have no guarantee that these imports will continue to work from one version to the next.
230-
231-
:::
232-
233-
A great way to use these bundles is to configure bundler export conditions, for example with [webpack's `resolve.conditionNames`](https://webpack.js.org/configuration/resolve/#resolveconditionnames) or [vite's `resolve.conditions`](https://vite.dev/config/shared-options#resolve-conditions):
234-
235-
```js
236-
// webpack.config.js
237-
{
238-
resolve: {
239-
conditionNames: ['mui-modern', '...'],
240-
}
241-
}
242-
243-
// vite.config.js
244-
{
245-
resolve: {
246-
conditions: ['mui-modern', 'module', 'browser', 'development|production']
247-
}
248-
}
249-
```

docs/data/material/migration/upgrade-to-v7/upgrade-to-v7.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,30 @@ Deep imports with more than one level are no longer working, at all (they were a
9393

9494
This was never officially supported, but now it will be restricted by bundlers and runtimes.
9595

96-
To use the modern bundle (which excludes legacy browser support for smaller bundle size), you'll need to configure your bundler to use the "mui-modern" exports condition:
96+
Modern bundles have also been removed, as the potential for a smaller bundle size is no longer significant.
97+
If you've configured aliases for these bundles, you must remove them now.
9798

98-
```js
99-
// webpack.config.js
100-
{
101-
resolve: {
102-
conditionNames: ['mui-modern', '...'],
103-
}
104-
}
105-
106-
// vite.config.js
107-
{
108-
resolve: {
109-
conditions: ['mui-modern', 'module', 'browser', 'development|production']
110-
}
111-
}
99+
```diff
100+
{
101+
resolve: {
102+
alias: {
103+
- '@mui/material': '@mui/material/modern',
104+
- '@mui/styled-engine': '@mui/styled-engine/modern',
105+
- '@mui/system': '@mui/system/modern',
106+
- '@mui/base': '@mui/base/modern',
107+
- '@mui/utils': '@mui/utils/modern',
108+
- '@mui/lab': '@mui/lab/modern',
109+
}
110+
}
111+
}
112112
```
113113

114+
:::info
115+
Earlier versions of this guide mention the existence of a `mui-modern` conditional exports.
116+
This has since been removed.
117+
This is a non-breaking change, and your bundler will fall back to the ESM bundle.
118+
:::
119+
114120
If you are using a Vite alias to force ESM imports for the icons package, you should remove it as it's no longer necessary:
115121

116122
```diff

packages/mui-base/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"url": "https://opencollective.com/mui-org"
2828
},
2929
"scripts": {
30-
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
31-
"build:modern": "node ../../scripts/build.mjs modern",
30+
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
3231
"build:node": "node ../../scripts/build.mjs node",
3332
"build:stable": "node ../../scripts/build.mjs stable",
3433
"build:copy-files": "node ../../scripts/copyFiles.mjs",

packages/mui-docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"homepage": "https://github.com/mui/material-ui/tree/master/packages/mui-docs",
2525
"scripts": {
26-
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
26+
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
2727
"build:modern": "echo 'Skip modern build'",
2828
"build:node": "node ../../scripts/build.mjs node",
2929
"build:stable": "node ../../scripts/build.mjs stable",

packages/mui-joy/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
"url": "https://opencollective.com/mui-org"
2626
},
2727
"scripts": {
28-
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
29-
"build:modern": "node ../../scripts/build.mjs modern",
28+
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
3029
"build:node": "node ../../scripts/build.mjs node",
3130
"build:stable": "node ../../scripts/build.mjs stable",
3231
"build:copy-files": "node ../../scripts/copyFiles.mjs",

packages/mui-lab/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"url": "https://opencollective.com/mui-org"
2929
},
3030
"scripts": {
31-
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
32-
"build:modern": "node ../../scripts/build.mjs modern",
31+
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
3332
"build:node": "node ../../scripts/build.mjs node",
3433
"build:stable": "node ../../scripts/build.mjs stable",
3534
"build:copy-files": "node ../../scripts/copyFiles.mjs",

packages/mui-material-nextjs/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
"url": "https://opencollective.com/mui-org"
2525
},
2626
"scripts": {
27-
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
28-
"build:modern": "node ../../scripts/build.mjs modern",
27+
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
2928
"build:node": "node ../../scripts/build.mjs node",
3029
"build:stable": "node ../../scripts/build.mjs stable",
3130
"build:copy-files": "node ../../scripts/copyFiles.mjs",

packages/mui-material-pigment-css/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"url": "https://opencollective.com/mui-org"
2727
},
2828
"scripts": {
29-
"build": "pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
30-
"build:modern": "node ../../scripts/build.mjs modern",
29+
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
3130
"build:node": "node ../../scripts/build.mjs node",
3231
"build:stable": "node ../../scripts/build.mjs stable",
3332
"build:copy-files": "node ../../scripts/copyFiles.mjs styles.css",

0 commit comments

Comments
 (0)