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-material] Importing from @mui/icons-material throws error in Remix/Vite #44265

Open
1 task done
Tracked by #43938
ramiroazar opened this issue Oct 30, 2024 · 2 comments · May be fixed by #43264
Open
1 task done
Tracked by #43938

[icons-material] Importing from @mui/icons-material throws error in Remix/Vite #44265

ramiroazar opened this issue Oct 30, 2024 · 2 comments · May be fixed by #43264
Assignees
Labels
bug 🐛 Something doesn't work package: icons Specific to @mui/icons

Comments

@ramiroazar
Copy link

ramiroazar commented Oct 30, 2024

Search keywords

module, cjs, mjs, icons, vite, remix

Latest version

  • I have tested the latest version

Steps to reproduce

  1. Open reproduction
  2. Notice error

Current behavior

Importing an icon from @mui/icons-material throws the following warning and error.

Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.

Screenshot 2024-10-30 at 3 43 40 PM

SyntaxError: Cannot use import statement outside a module

Screenshot 2024-10-30 at 3 38 25 PM

Expected behavior

Importing an icon from @mui/icons-material shouldn't throw an error.

Context

We're trying to use @mui/icons-material in a Remix project.

Your environment

npx @mui/envinfo
System:
    OS: macOS 14.5
  Binaries:
    Node: 22.2.0 - ~/.nvm/versions/node/v22.2.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v22.2.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 130.0.6723.91
    Edge: Not Found
    Safari: 17.5
  npmPackages:
    @mui/core-downloads-tracker:  6.1.5 
    @mui/icons-material: ^6.1.5 => 6.1.5 
    @mui/material:  6.1.5 
    @mui/private-theming:  6.1.5 
    @mui/styled-engine:  6.1.5 
    @mui/system:  6.1.5 
    @mui/types:  7.2.18 
    @mui/utils:  6.1.5 
    @types/react: ^18.2.20 => 18.3.10 
    react: ^18.2.0 => 18.3.1 
    react-dom: ^18.2.0 => 18.3.1 
    typescript: ^5.1.6 => 5.6.2
@ramiroazar ramiroazar added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 30, 2024
@zannager zannager added the package: icons Specific to @mui/icons label Oct 30, 2024
@joebochill
Copy link

In case this helps anyone else, I ran into the same error while trying to migrate a simple Vite project to use the new PigmentCSS engine (removing all of my ownerState instances). One of the overrides in my theme set a default property to a different icon. I read a little further ahead in the migration guide and after switching to using the DefaultPropsProvider, the error went away.

@siriwatknp siriwatknp assigned Janpot and unassigned siriwatknp Nov 13, 2024
@DiegoAndai
Copy link
Member

Thanks for the report @ramiroazar, this is a bug.

@Janpot this looks like the same root cause that #43980 (comment). Is it?

@DiegoAndai DiegoAndai added bug 🐛 Something doesn't work and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 29, 2024
@DiegoAndai DiegoAndai changed the title Importing from @mui/icons-material throws error [icons-material] Importing from @mui/icons-material throws error in Remix/Vite Nov 29, 2024
@DiegoAndai DiegoAndai linked a pull request Dec 3, 2024 that will close this issue
13 tasks
@Janpot Janpot mentioned this issue Jan 7, 2025
14 tasks
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

Successfully merging a pull request may close this issue.

6 participants