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

[V3] MUI Icons Not Treeshaking During Build #8945

Closed
7 tasks done
nrayburn-tech opened this issue Jul 6, 2022 · 2 comments
Closed
7 tasks done

[V3] MUI Icons Not Treeshaking During Build #8945

nrayburn-tech opened this issue Jul 6, 2022 · 2 comments

Comments

@nrayburn-tech
Copy link

Describe the bug

When building an app that imports from @mui/icons-material the final bundle is not tree shaken as expected with V3. V2 works as expected.

import Home from '@mui/icons-material/Home'; is tree shaken.
import { Home } from '@mui/icons-material'; is not tree shaken.

  1. Open the repro link.
  2. Run npm run build.
  3. Note the build size.
  4. Modify the import to be import Home from '@mui/icons-material/Home'; instead.
  5. Run npm run build.
  6. Note the build size.
  7. Compare the build sizes from each build and see a significant difference.

Reproduction

https://stackblitz.com/edit/vitejs-vite-fwmm5t?file=src%2FApp.tsx&terminal=dev

System Info

System:
  OS: Linux 5.0 undefined
  CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 0 Bytes / 0 Bytes
  Shell: 1.0 - /bin/jsh
Binaries:
  Node: 16.14.2 - /usr/local/bin/node
  Yarn: 1.22.10 - /bin/yarn
  npm: 7.17.0 - /bin/npm
npmPackages:
  @vitejs/plugin-react: ^2.0.0-beta.0 => 2.0.0-beta.0 
  vite: ^3.0.0-beta.6 => 3.0.0-beta.6

Used Package Manager

npm

Logs

No response

Validations

@nrayburn-tech
Copy link
Author

#8942 might be related, but there aren't many details there.
I also found some issues with a sideEffects property that might have some impact, but I am not sure if they are relevant or not here.

@sapphi-red
Copy link
Member

I think this is same with #8464. Closing to keep a single discussion going.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants