Comment by koakuma-chan

4 months ago

I used Next.js with mui.com at one point, and after each change in dev mode it took 10s to recompile. I don’t touch anything that has to do with Vercel ever since then.

Next.js doesn't play well with barrel packages (large packages that export everything into the main entrypoint file). It's a known issue (but rarely mentioned when you read about working with Next.js):

https://github.com/vercel/next.js/issues/48748

I've never used MUI, but assuming that MUI is a barrel package, and you do the following:

  import { Component } from "mui";

Next.js ends up compiling the entire package instead of just that component you need. If MUI has their components exported into separate files, an optimization would be:

  import { Component } from "mui/path/to/component";

That sounds like a MUI problem, not a next problem. What a clunky UI framework. Next plus tailwind remains lightning fast for me.