Is their a reason @mui/x-date-pickers is in my bundle when I don't have it enabled or imported?
material-react-table version
3.0.1
react & react-dom versions
19.0.0
Describe the bug and the steps to reproduce it
I am using vite with the rollup-plugin-visualizer. Just curious if this is intended or if I have misconfigured the table?
Minimal, Reproducible Example - (Optional, but Recommended)
- Install and use material react table with a bundle analyzer
- See that @mui/x-date-pickers and its full bundle is included
Screenshots or Videos (Optional)
Do you intend to try to help solve this bug with your own PR?
None
Terms
- [X] I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
MRT imports it
@KevinVandy maybe a feature request then? Why is this in the bundle? Can it be injected instead?
Maybe in the future
Experimenting with config options on my own rollup but their potentially is a import leak here
node_modules\material-react-table\dist\index.d.ts
I cant see any other reason for the whole package to be imported
Your prod bundle should only be importing the actual components used by MRT, not the entire library. Are you saying that's what's happening?
Yes that's what's happening. Sounds like it might be an issue that only I am facing? I'll pull up a separate repo end experiment when I get back from holiday
Experimenting with config options on my own rollup but their potentially is a import leak here
node_modules\material-react-table\dist\index.d.ts
I cant see any other reason for the whole package to be imported
Can confirm this is an issue - x-date-pickers alone is 471kb.
In a minimalist example alone of only rendering MRT + grid and no other MUI components and < 10 rows of data + 5 columns (following the most basic example), I get a bundle size of 521kb (146kb gzip).
Mui-modern preference does not seem to help with tree shaking so the only thing that can be done to help at all is lazy-loading.
If I comment out these lines from node_modules/material-react-table/dist/index.esm.js
//import { DatePicker } from '@mui/x-date-pickers/DatePicker';
//import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
//import { TimePicker } from '@mui/x-date-pickers/TimePicker';
then my bundle size goes down by 219kb. I assume this breaks something if I was using the date picker features but I don't think I am.