Replies: 6 comments 6 replies
-
I think this is a bigger issue with MUI in general, and even worse when it's used with Typescript... MUI have a guide on how to reduce the issue when using Babel Edit
https://nextjs.org/docs/advanced-features/compiler#modularize-imports |
Beta Was this translation helpful? Give feedback.
-
@MJtH I'm familiar with the guide, I still think it should be possible not to load entire lib should be oossible and take less time, or caching it as I said before.. |
Beta Was this translation helpful? Give feedback.
-
@omerman the issue is with MUI and is not specific to Next.js. I just filed an RFC here: mui/material-ui#35840 |
Beta Was this translation helpful? Give feedback.
-
@omerman @MJtH
|
Beta Was this translation helpful? Give feedback.
-
Hi guys, very much a novice to this, but experiencing the issues documented here. I did attempt the |
Beta Was this translation helpful? Give feedback.
-
For anyone else having this issue, I did some digging, and these are ideas that I've tried that optimize development building (not production building) with MUI and Next.js: Option 1: Switch to Turbopack during npm run dev (warning: in beta)
Option 2: Lazy Load & Exclude selective libraries from initial webpack
I ended up using and merging Option 1 into my main branch. I also have a feeling you could combine the two options for even more speed. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I recently started working with mui v5.
I noticed that development will compile slowly if directly importing from @mui/material.
I was able to fix it using modularizeImports
It seems like an issue with SWC development server, I think it would be be best if SWC in dev either won't load all of
@mui/material
especially when a large chunk should be tree shaked. Or at least cache it once in a friendly way.Please let me know what you think
Beta Was this translation helpful? Give feedback.
All reactions