[Feature]: better treeshaking when lib conditional judgment e.g: process.env.NODE_ENV
#8487
Labels
A-treeshaking
Area: treeshaking
process.env.NODE_ENV
#8487
System Info
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 124.89 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Browsers:
Chrome: 131.0.6778.70
Chrome Canary: 133.0.6847.0
Safari: 17.6
Details
DCE analysis in one big esm file, compared with rollup
https://github.com/SoonIter/rspack-rollup-treeshake-repro
Result
rsbuild 3875kb > vite(rollup) 812kb
rsbuild
ready Built in 0.95 s (web) File (web) Size Gzip dist-rsbuild/index.html 0.31 kB 0.22 kB dist-rsbuild/static/js/index.f63e9bd1.js 1.8 kB 0.90 kB dist-rsbuild/static/js/698.df5bb1bd.js 3875.7 kB 1683.1 kB Total: 3877.8 kB (gzip: 1684.2 kB)
vite(rollup)
Reproduce link
https://github.com/SoonIter/rspack-rollup-treeshake-repro
Reproduce Steps
The text was updated successfully, but these errors were encountered: