Skip to content
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

[data grid] All locales are present in production bundle when using pro/premium #16235

Open
ddolcimascolo opened this issue Jan 18, 2025 · 4 comments
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! plan: Premium Impact at least one Premium user support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/

Comments

@ddolcimascolo
Copy link

ddolcimascolo commented Jan 18, 2025

Steps to reproduce

Steps:

  1. Open this link to live example: https://github.com/ddolcimascolo/mui-x-datagrid-premium-locales
  2. Run npm i followed by npm run analyze and examine the bundle analysis

Current behavior

All locales are in the final bundle

Expected behavior

Only the imported locales are in the production bundle.

Context

I'm trying to reduce my bundle size.
Note that importing from @mui/x-data-grid (the free version) works as expected, but I don't think I have to install it when I'm using the premium one...

Your environment

npx @mui/envinfo
System:
    OS: Linux 6.8 Linux Mint 22.1 (Xia)
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 132.0.6834.83

Search keywords: datagrid premium locales

Order ID: 78178

@ddolcimascolo ddolcimascolo added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 18, 2025
@github-actions github-actions bot added component: data grid This is the name of the generic UI component, not the React module! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Jan 18, 2025
@ddolcimascolo
Copy link
Author

Please also note that the problem is not there with pickers locales, even imported from @mui/x-date-pickers-pro

David

@michelengelen
Copy link
Member

That is indeed strange... the structure is the same for pickers-pro and data-grid-pro/-premium. We use export * from '<base-package>/locales for both.

@arminmeh do you know why it behaves like this?

@michelengelen michelengelen changed the title [DatGridPremium] All locales are present in production bundle [data grid] All locales are present in production bundle when using pro/premium Jan 20, 2025
@arminmeh arminmeh added the plan: Premium Impact at least one Premium user label Jan 22, 2025
@arminmeh
Copy link
Contributor

We are just re-exporting locales from the community package.
Compiled, this does not allow proper tree shaking. Same happens with the Pro package.

I will put this on the board.

@ddolcimascolo, as a temporary workaround, you can import locales from @mui/x-data-grid. This does not require any additional dependency, since @mui/x-data-grid-premium depends on @mui/x-data-grid and you should have it in your node_modules already.

@arminmeh arminmeh removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 22, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Jan 22, 2025
@arminmeh arminmeh moved this from 🆕 Needs refinement to 🔖 Ready in MUI X Data Grid Jan 22, 2025
@ddolcimascolo
Copy link
Author

We are just re-exporting locales from the community package. Compiled, this does not allow proper tree shaking. Same happens with the Pro package.

I will put this on the board.

@ddolcimascolo, as a temporary workaround, you can import locales from @mui/x-data-grid. This does not require any additional dependency, since @mui/x-data-grid-premium depends on @mui/x-data-grid and you should have it in your node_modules already.

Thx for confirming this as a bug. I was aware of the workaround and can confirm it works.

David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! plan: Premium Impact at least one Premium user support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/
Projects
Status: 🔖 Ready
Development

No branches or pull requests

3 participants