-
-
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
[icons-material] Add types to ESM icons #38742
Conversation
Netlify deploy previewhttps://deploy-preview-38742--material-ui.netlify.app/ Bundle size report |
I don't think we can merge this, direct imports from /esm are not supported. It's a private API.
https://mui.com/material-ui/guides/minimizing-bundle-size/#available-bundles Would the proposal there solve the issue?
|
I see, thanks for the reply. It seems odd that you can get away with Aliasing is fine, but that means I need to alias for Vite, Webpack, Jest, and anything else that needs to know how to resolve stuff. It's a bit of a pain. I will patch the |
Turns out neither of those are options for me because |
@oliviertassinari Any suggestions on how to proceed? |
They might get surprises, we might rename the esm folder from one release to another 😅. |
I worked around this by adding more export conditions. Looking forward to MUI exposing ESM that can be picked up automatically by tools. |
@Methuselah96 Does it work when you use a negative lookahead to exclude the resolve: {
alias: [
{
find: /^@mui\/icons-material\/(?!esm\/)([^/]*)/,
replacement: '@mui/icons-material/esm/$1',
},
],
}, ( |
@Janpot Probably, thanks for the tip, but I have multiple tools that need to know about this alias, so I didn't want to have to declare it each one. I ended up patching the |
Please add the esm option otherwise vite fails when using mui with |
Context
I am encountering this issue. I have narrowed it down to an issue with esbuild that only occurs in this case when CJS and ESM are mixed. In order to workaround this I would like to switch to using the icons in
@mui/icons-material/esm
, but they have no types.Changes
Add types to the icons in
@mui/icons-material/esm
directory so they can be imported in a TypeScript project.