-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Portal] Migrate to unstyled #24890
[Portal] Migrate to unstyled #24890
Conversation
@material-ui/unstyled: parsed: +2.70% , gzip: +2.51% |
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 don't think that Portal should be prefixed with unstyled, as by definition, there are no styled version of it.
I think that the solution should be about moving the source from @material-ui/core
to @material-ui/unstyled
while reexporting the component in the core. The diff should be in the order of magnitude of +10/-10 LOCs.
Got it |
@oliviertassinari I left export from @material-ui/core/Portal if I remove it it will be breaking change. |
docs/translations/api-docs/portal-unstyled/portal-unstyled-fr.json
Outdated
Show resolved
Hide resolved
// Resolve imports like: | ||
// import Portal from '@material-ui/unstyled/Portal'; |
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.
Shouldn't this be done by babel-plugin-module-resolver
?
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.
It also seems to work with:
diff --git a/babel.config.js b/babel.config.js
index 658f4724f9..f2a14b0472 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -132,6 +132,19 @@ module.exports = function getBabelConfig(api) {
],
],
},
+ rollup: {
+ plugins: [
+ [
+ 'babel-plugin-module-resolver',
+ {
+ root: ['./'],
+ alias: {
+ '@material-ui/unstyled': path.resolve(__dirname, './packages/material-ui-unstyled/src'),
+ },
+ },
+ ],
+ ],
+ },
benchmark: {
plugins: [
...productionPlugins,
diff --git a/packages/material-ui/package.json b/packages/material-ui/package.json
index fad598de19..2b67f5fdcf 100644
--- a/packages/material-ui/package.json
+++ b/packages/material-ui/package.json
@@ -31,7 +31,7 @@
"build:modern": "node ../../scripts/build modern",
"build:node": "node ../../scripts/build node",
"build:stable": "node ../../scripts/build stable",
- "build:umd": "cross-env BABEL_ENV=stable rollup -c scripts/rollup.config.js",
+ "build:umd": "cross-env BABEL_ENV=rollup rollup -c scripts/rollup.config.js",
"build:copy-files": "node ../../scripts/copy-files.js",
"build:types": "node ../../scripts/buildTypes",
"extract-error-codes": "cross-env MUI_EXTRACT_ERROR_CODES=true yarn build:modern",
diff --git a/packages/material-ui/scripts/rollup.config.js b/packages/material-ui/scripts/rollup.config.js
index 8112288071..19460964f1 100644
--- a/packages/material-ui/scripts/rollup.config.js
+++ b/packages/material-ui/scripts/rollup.config.js
@@ -94,7 +94,7 @@ export default [
external: Object.keys(globals),
plugins: [
nodeResolve(nodeOptions),
- nestedFolder,
+ // nestedFolder,
babel(babelOptions),
commonjs(commonjsOptions),
nodeGlobals(), // Wait for https://github.com/cssinjs/jss/pull/893
A preference?
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.
Fine for now. I'll improve it in a follow-up. Our babel config already has all the relevant information. We just need to reconcile it with the rollup externals.
@povilass Alright, one item done :) |
Task by #24857 request.