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 not working in v3 beta #8713

Closed
7 tasks done
bysja opened this issue Jun 22, 2022 · 2 comments
Closed
7 tasks done

Tree-shaking not working in v3 beta #8713

bysja opened this issue Jun 22, 2022 · 2 comments

Comments

@bysja
Copy link

bysja commented Jun 22, 2022

Describe the bug

I upgraded Vite to 3.0.0-beta.0 to resolve this issue, which prevents me from using v2.9 right now.

However, tree-shaking fails for every library I import in v3, despite working properly in v2.9.

The reproduction example imports a single icon from an external library (@heroicons/react) with the following JS bundle sizes when runing vite build:

v3.0.0-beta.0 / @vitejs/plugin-react v2.0.0-beta.0
239.07 KiB / gzip: 60.83 KiB

v2.9.12 / @vitejs/plugin-react v1.3.2
140.52 KiB / gzip: 45.34 KiB

The v3 repo is attached in the reproduction link.

Here is the v2.9 repo for comparison: https://github.com/bysja/vitejs-vite-v2-treeshaking

Reproduction

https://github.com/bysja/vitejs-vite-v3-treeshaking

System Info

Default StackBlitz environment

Used Package Manager

npm

Logs

v3
❯ npm run build
$ vite build
vite v3.0.0-beta.0 building for production...
✓ 14 modules transformed.
dist/assets/react.35ef61ed.svg 4.03 KiB
dist/index.html 0.44 KiB
dist/assets/index.3fce1f81.css 1.37 KiB / gzip: 0.71 KiB
dist/assets/index.eebf1dba.js 239.07 KiB / gzip: 60.83 KiB

v2.9
❯ npm run build
$ vite build
vite v2.9.12 building for production...
✓ 266 modules transformed.
dist/assets/react.35ef61ed.svg 4.03 KiB
dist/index.html 0.44 KiB
dist/assets/index.b9195027.css 1.37 KiB / gzip: 0.71 KiB
dist/assets/index.ba61e0ad.js 140.52 KiB / gzip: 45.34 KiB

Validations

@sapphi-red
Copy link
Member

related: #8464

@bluwy
Copy link
Member

bluwy commented Jun 24, 2022

I think the core issue may be the same as #8464. Closing to keep a single discussion going.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 9, 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

3 participants