-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[code-infra] Remove commonjs imports in docs #44976
Conversation
Netlify deploy previewhttps://deploy-preview-44976--material-ui.netlify.app/ Bundle size report |
"./loader": "./loader.mjs", | ||
"./prism": { | ||
"types": "./prism.d.mts", | ||
"require": "./prism.cjs", |
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.
Is their a reason to continue exporting a cjs?
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.
Yes, regression tests at the moment still select the cjs variant. I'm moving them to vite in follow-up.
test: /\.(js|ts|tsx)$/, | ||
// prism.js blocks @mui/internal-markdown/prism from being interpreted as ESM in this build. | ||
exclude: /node_modules|prism\.js/, | ||
test: /\.(js|mjs|ts|tsx)$/, |
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.
If I understand corectly, this is to be able to run test on markdown new files.
I've seen similar update on the mui-x PR (mui/mui-x#16112) but no .mjs files added. Is their a specific reason?
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.
If I understand corectly, this is to be able to run test on markdown new files.
It's to include the mjs files of @mui/internal-markdown
in the compilation.
...Is their a specific reason?
Yes, I added it there as well, only in X, this rule is configured in webpackBaseConfig for some reason. After I move the tests to vite, I think only eslint will still be using this config for its aliases, so we should be able to remove the rule altogether.
Tried to port regression test fixtures to vite but it chokes on these imports of commonjs modules. I've struggled several times as well with this in the past.
Removed the mixing of module systems altogether so no-one has to waste any more time on this. This should also unblock #44964
blocked on mui/mui-x#16112