Skip to content

@mui/material/styles/styled 4 level import fixed - #32

Merged
steviebuilds merged 2 commits into
steviebuilds:mainfrom
abelozerov:fix_mui_4_level_imports
Apr 20, 2023
Merged

@mui/material/styles/styled 4 level import fixed#32
steviebuilds merged 2 commits into
steviebuilds:mainfrom
abelozerov:fix_mui_4_level_imports

Conversation

@abelozerov

Copy link
Copy Markdown
Contributor

Unsupported MUI 4 level import fixed.
"@mui/material": "5.11.4"

See mui/material-ui#35773 (comment)

Caused:

SyntaxError: Cannot use import statement outside a module
 ❯ Object.<anonymous> node_modules/mui-nested-menu/index.js:7:38

Module /node_modules/@mui/material/styles/styled.js:1 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "@mui/material" asking them to ship the file in .mjs extension or add "type": "module" in their package.json.

As a temporary workaround you can try to inline the package by updating your config:

// vitest.config.js
export default {
  test: {
    deps: {
      inline: [
        "@mui/material"
      ]
    }
  }
}

@vercel

vercel Bot commented Jan 17, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mui-nested-menu ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2023 5:03am

@steviebuilds

Copy link
Copy Markdown
Owner

Published under 2.2.1. Thanks for contributing.

@abelozerov
abelozerov deleted the fix_mui_4_level_imports branch April 20, 2023 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants