-
-
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
Slow render when using Vite + Pigment + Icons #43586
Comments
I changed the first line of import to import CheckCircle from '@mui/icons-material/CheckCircle';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff'; Could you try with this change? Also, could you share how slow the build actually is ? |
@brijeshb42 Using the repository above, simply changing the import resulted in I'm working on getting a video of the slow startup time. I'll add it here once I'm finished. |
@brijeshb42 Here is the slow initial render (apologies for the awful quality, it's just 4 minutes of loading so I had to reduce the quality in order to upload it...). As a result of the long startup, my guess is with test.movHere is a much faster initial render simply by commenting out the import of the icons and the areas where it is used. test2.mov |
Could you try updating your vite config to this - export default defineConfig({
plugins: [react(), pigment(pigmentConfig)],
resolve: {
alias: [
{
find: /^@mui\/icons-material\/(.*)/,
replacement: '@mui/icons-material/esm/$1',
},
],
},
}); We have an upcoming change in the icons package to natively support this. Once that lands, you won't need this explicit |
@brijeshb42 The config change above doesn't appear to resolve the issue. |
a.patch |
@brijeshb42 This looks like it resolved the issue. I was only able to quickly test it but will be doing a more thorough investigation in the following days. Thanks! |
Ok. Feel free to close the issue if it's resolved. |
Patch works well. Thanks! |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note We value your feedback @iM-GeeKy! How was your experience with our support team? |
Steps to reproduce
Link to live example: https://github.com/iM-GeeKy/material-ui-pigment-css-vite-ts
Steps:
bun install
bun run dev
Current behavior
Local site takes an extremely long amount of time to render (
@mui/icons-material
appears to be the main culprit).Expected behavior
Importing
@mui/icons-material
should not cause such a massive start up time.Context
Using
examples/material-ui-pigment-css-vite-ts
as a starting point and in an effort to upgrade my internal application from v5 to v6, the same code in theApp.tsx
rendered extremely quickly, but the same code after migrated takes several minutes. Consequently, Vitests appear to run out of memory which appears to be related to the same long render problem. My guess is it's pulling in the entire icon library, but following the minimizing bundle size docs didn't seem to resolve the issue. Any help would be greatly appreciated.Your environment
npx @mui/envinfo
Search keywords: Icons, Vite, Pigment
The text was updated successfully, but these errors were encountered: