-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
Decrease bundle size #1008
Comments
|
|
@WangLarry Are there any specific problems you'd like to point out? |
235 request, too many. I have tested,it will decrease request times to 95 Are you understand? Sorry my bad english |
I'm not sure that would work well with imports like: import Button, { buttonClasses } from "@mui/material/Button"; |
|
@WangLarry The point was that it requires us to hardcode the exports of each of those modules imported, which will be a maintenance burden as we'll have to keep it up to date as // ./loadModule.ts
// ...
const muiExports = await import('./muiExports')
// ... import muiMaterialDefault, * as muiMaterial from '@mui/material';
import muiMaterialAccordionDefault, * as muiMaterialAccordion from '@mui/material/Accordion';
// ...
function esm(defaultExport: any, namedExports: any) {
return { ...namedExports, default: defaultExport, __esModule: true };
}
export default new Map([
['@mui/material', esm(muiMaterial, muiMaterialDefault)],
['@mui/material/Accordion', esm(muiMaterialAccordionDefault, muiMaterialAccordion)],
// ...
]); It's still not great as it still imports all library code, even when unused, but it will use less requests. It also hacks esm support on top of commonjs which will for sure run into edge cases at some point. In the future we could look into either a pure ESM runtime that only loads used components, or a serverside compilation step for deployed applications. |
Closing this issue as we have replaced the runtime with |
Duplicates
Latest version
Summary 💡
I use @next/bundle-analyzer to analyze toolpad-app. It show there are two huge packages: monaco-editor and @mui/icons-material.
Examples 🌈
No response
Motivation 🔦
No response
The text was updated successfully, but these errors were encountered: