CJS/ESM Issue with @mui as nested dependency #1590
Unanswered
MikaelColliander
asked this question in
Help & Questions
Replies: 2 comments 2 replies
-
When adding to vite.config
There is another error:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Can you make it a minmal reproduction? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, any help in resolving my issue would be deeply appreciated.
With the plugin
vite-plugin-cjs-interop
I am able to use @mui/material within my Vike application code, directly. As suggested here: https://github.com/brillout/vike-with-mui/blob/main/vite.config.tsHowever, I use packages that in turn depend on @mui packages which yields the CJS/ESM Issue error when running
npm run dev
.Here is a reproduction repo:
https://github.com/MikaelColliander/vike-test/blob/main/layouts/LayoutDefault.tsx
Here is the relevant output:
node_modules/@sj-ab/component-library.ui.theme-provider/ThemeProvider.tsx:2 import { ThemeProvider as MuiThemeProvider } from "@mui/material/styles"; ^ SyntaxError: The requested module '@mui/material/styles' does not provide an export named 'ThemeProvider' at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21) at ModuleJob.run (node:internal/modules/esm/module_job:190:5) ┌────────────────────────────────────────────────────────────────────────────────┐ │ The error seems to be a CJS/ESM issue, see https://vike.dev/broken-npm-package │ └────────────────────────────────────────────────────────────────────────────────┘
Beta Was this translation helpful? Give feedback.
All reactions