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

Tree-shaking Material Taiwind #692

Open
saiuttej-b opened this issue May 30, 2024 · 1 comment
Open

Tree-shaking Material Taiwind #692

saiuttej-b opened this issue May 30, 2024 · 1 comment

Comments

@saiuttej-b
Copy link

saiuttej-b commented May 30, 2024

I tried building the project and used "rollup-plugin-visualizer" when building my Vite react project and I see that all the Material Tailwind Components are included in my production build bundle, even if I did not use all the components.

Is there any way to fix it?

@supermario12342003
Copy link

is it a vite problem or material-tailwind problem? im using vite + material-tailwind in my project and i have the same issue, notice the tree shake is not working either, but it's the same case for flowbite, until i put an adjustment like this in the vite.config.

rollupOptions: {
      treeshake: {
        moduleSideEffects: (id) => {
          return (
            id.includes("flowbite-react")
            || id.includes("material-tailwind/react")
          ) ? false : null;
        },
      },
      ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants