You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open localhost:3000 and check the console output to see the error
vite.config.ts
import{defineConfig}from'vite'importreactfrom'@vitejs/plugin-react'// https://vitejs.dev/config/exportdefaultdefineConfig({plugins: [react()],build: {minify: false,// to be readablerollupOptions: {output: {manualChunks: {emotionStyled: ["@emotion/styled"],emotionReact: ["@emotion/react"],}},},},})
Current behavior
When using manual chunks in the rollup config, to reduce the individual chunk size, the order in which the chunks are build matters since MUI v6.1.0.
We add manual chunking to improve load times. Usually we simply do so by placing every dependency in it's own chunk and that worked very good till MUI v6.1.0 (reverting back to MUI v6.0.2 works fine).
The issue is broken down with the chunking settings below. When changing the order of both entries, everything works just fine.
BreakBB
changed the title
Order of @emotion/styled and @emotion/react is important since 6.1.0
Load order of @emotion/styled and @emotion/react is important since 6.1.0
Sep 19, 2024
Steps to reproduce
Link to live example: (required)Steps:
npm create vite@4.4.5
npm install
in the freshly created projectnpm install @mui/material@6.1.0 @emotion/react@11.13.3 @emotion/styled@11.13.0
vite.config.ts
to look like belownpm run build
npx serve -s dist
localhost:3000
and check the console output to see the errorvite.config.ts
Current behavior
When using manual chunks in the rollup config, to reduce the individual chunk size, the order in which the chunks are build matters since MUI v6.1.0.
We add manual chunking to improve load times. Usually we simply do so by placing every dependency in it's own chunk and that worked very good till MUI v6.1.0 (reverting back to MUI v6.0.2 works fine).
The issue is broken down with the chunking settings below. When changing the order of both entries, everything works just fine.
Broken:
Works:
In Firefox the error message is:
React
is imported from thereact
chunk.Expected behavior
Manual chunking should not effect the startup of MUI.
Context
No response
Your environment
npx @mui/envinfo
Search keywords: rollup chunks vite React emotion
The text was updated successfully, but these errors were encountered: