-
-
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
[docs] Next.js 13 transpilePackages and modularizeImports #36218
Comments
The |
We have the same issue with |
Hi, I am still getting the below error - Even though I used @mui/material/styles for the Theme provider |
Are you using the treanspilePackages only for @mui/material-icons? |
There are workarounds, for example:
|
At that point I would be fine with having a codemod that transforms all top level imports to 2nd level or default imports. Else it's just workarounds that can break easily when upgrading. |
Still having this issue X.x. not sure what the long term solution is here |
I found a workaround (spends almost a day just for this) modularizeImports: {
'@mui/material/!(styles)/?*': {
transform: '@mui/material/{{path}}/{{member}}',
skipDefaultConversion: true,
},
'@mui/icons-material/?(((\\w*)?/?)*)': {
transform: '@mui/icons-material/{{ matches.[1] }}/{{member}}',
},
}, works just fine for me |
I was scratching my head over this today when i started a new project and i get:
|
Use |
It didn't work for me even after I changed the import @nik0145 The one that works was @zourdyzou solution because i modularized the import for performance previously
|
I think this problem is solved now, per #35450 (comment). |
Duplicates
Related page
https://mui.com/material-ui/guides/styled-engine/
Kind of issue
Missing information
Issue description
My project is a monorepository using Turborepo. I'm using Next.js 13 and would like to optimize the performance. I found an article where they use the new transpilePackages and modularizeImports properties to optimize the imports in the application (see here).
If I set up next.config.js according to the article. That is, I add @mui libraries to the transpilePackages parameter and then use the same parameters as in the article to modularizeImports:
I get a module not found error if I import css or styled from @mui/material:
I tried a lot of things and managed to get another similar bug, but with the alpha function (and some others as well). I assume the modularizeImports parameters are not correct, but I don't know how it should be correct.
Context 🔦
I found a page in the documentation regarding which I'm opening this issue, which still uses the next-transpile-modules package (replaced in just Next.js 13). I would be glad if this would also appear somewhere in the documentation and how to set it up properly. It would improve the performance of the application a lot.
The text was updated successfully, but these errors were encountered: