Skip to content
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] Dev server breaks when icon is imported from @mui/icons-material/Icon #43821

Closed
marvinruder opened this issue Sep 7, 2024 · 4 comments
Assignees
Labels
bug 🐛 Something doesn't work package: icons Specific to @mui/icons

Comments

@marvinruder
Copy link

marvinruder commented Sep 7, 2024

Steps to reproduce

  1. Checkout branch material-icons of https://github.com/marvinruder/material-ui-pigment-css-vite-ts
  2. Start dev server and open in browser

Current behavior

An empty page is shown with the following stack trace in the console:

Uncaught Error: Dynamic require of "@mui/material/utils" is not supported
    at chunk-7D4SUZUM.js?v=4726dafb:11:9
    at node_modules/@mui/icons-material/utils/createSvgIcon.js (createSvgIcon.js:13:14)
    at __require2 (chunk-7D4SUZUM.js?v=4726dafb:14:50)
    at node_modules/@mui/icons-material/Fingerprint.js (Fingerprint.js:9:45)
    at __require2 (chunk-7D4SUZUM.js?v=4726dafb:14:50)
    at Fingerprint.js:13:18

Expected behavior

The page is rendered normally.

Context

This issue does not occur when using vite preview (hosting static resources generated by vite build) or when importing icons from @mui/icons-material, like

import { Icon } from '@mui/icons-material';

However, the “safest [option] for bundle size” as advertised here is importing from @mui/icons-material/Icon, causing this issue.

Your environment

npx @mui/envinfo
  System:
    OS: macOS 14.6.1
  Binaries:
    Node: 22.8.0 - /opt/homebrew/bin/node
    npm: 10.8.2 - /opt/homebrew/bin/npm
    pnpm: 8.15.5 - /opt/homebrew/bin/pnpm
  Browsers (issue reproducable in all available):
    Chrome: 128.0.6613.120
    Edge: Not Found
    Safari: 17.6
  npmPackages:
    @emotion/react:  11.13.3 
    @emotion/styled:  11.13.0 
    @mui/core-downloads-tracker:  6.0.2 
    @mui/icons-material: latest => 6.0.2 
    @mui/material: latest => 6.0.2 
    @mui/material-pigment-css: latest => 6.0.2 
    @mui/private-theming:  6.0.2 
    @mui/styled-engine:  6.0.2 
    @mui/system:  6.0.2 
    @mui/types:  7.2.16 
    @mui/utils:  6.0.2 
    @pigment-css/react:  0.0.21 
    @pigment-css/vite-plugin: latest => 0.0.22 
    @types/react: latest => 18.3.5 
    react: latest => 18.3.1 
    react-dom: latest => 18.3.1 
    typescript: latest => 5.5.4 

Search keywords: icons

Search keywords:

@marvinruder marvinruder added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 7, 2024
@iM-GeeKy
Copy link

iM-GeeKy commented Sep 8, 2024

Relates to #43586

@zannager zannager added the package: icons Specific to @mui/icons label Sep 9, 2024
@marvinruder
Copy link
Author

A workaround is given by #43586 (comment).

@marvinruder
Copy link
Author

Fixed in v6.1.0, likely by #43624.

@marvinruder marvinruder closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 11, 2024
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

We value your feedback @marvinruder! How was your experience with our support team?
We'd love to hear your thoughts in this brief Support Satisfaction survey. Your insights help us improve!

@oliviertassinari oliviertassinari added external dependency Blocked by external dependency, we can’t do anything about it bug 🐛 Something doesn't work and removed package: icons Specific to @mui/icons labels Sep 19, 2024
@oliviertassinari oliviertassinari transferred this issue from mui/pigment-css Sep 19, 2024
@oliviertassinari oliviertassinari added package: icons Specific to @mui/icons and removed external dependency Blocked by external dependency, we can’t do anything about it labels Sep 19, 2024
@oliviertassinari oliviertassinari changed the title Dev server breaks when icon is imported from @mui/icons-material/Icon [icons] Dev server breaks when icon is imported from @mui/icons-material/Icon Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work package: icons Specific to @mui/icons
Projects
None yet
Development

No branches or pull requests

5 participants