Parcel: Tree-Shaking with react-intl library makes bundle even bigger

Created on 7 Aug 2018  ยท  6Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report


this project which only includes React and react-intl results in following builds:
normal build (no --experimental-scope-hoisting)

$ yarn build
yarn run v1.9.4
warning package.json: No license field
$ parcel build index.html
โˆš  Built in 32.81s.

dist\src.0a4b8332.map    โ€ผ  2.29 MB     337ms
dist\src.0a4b8332.js     โ€ผ  1.14 MB    13.68s
dist\index.html               159 B    18.58s
Done in 42.11s.

build with --experimental-scope-hoisting

$ yarn build --experimental-scope-hoisting
yarn run v1.9.4
warning package.json: No license field
$ parcel build index.html --experimental-scope-hoisting
โˆš  Built in 32.43s.

dist\src.3fbcb662.js    โ€ผ  1.32 MB    20.95s
dist\index.html              159 B    16.61s
Done in 37.49s.

With CRA the file size after gzip is 47kb (157kb non-gzipped)

๐Ÿค” Expected Behavior

The bundle should get smaller.

๐Ÿ˜ฏ Current Behavior

Getting bigger.

๐Ÿ’ป Code Sample

sandbox

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.9.7
| Node | 8.11.3
| npm/Yarn | 5.6.0 / 1.9.4
| Operating System | Win10

Bug Confirmed Bug Windows ๐ŸŒณ Tree Shaking

All 6 comments

Do you this still have this issue?

yup: I updated the dependencies (https://codesandbox.io/s/4zr09pqzo0), downloaded the sandbox-project and built it locally:
without --experimental-scope-hoisting
image

with --experimental-scope-hoisting
image

Why are your JS bundles (both) so large? On macOS:

$ parcel build index.html
โœจ  Built in 14.37s.

dist/src.e4004e4c.map    404.38 KB     166ms
dist/src.32972fef.js     160.19 KB    13.29s
dist/index.html              159 B     875ms


$ parcel build index.html --experimental-scope-hoisting
โœจ  Built in 18.14s.

dist/src.482df5c1.js    155.01 KB    17.07s
dist/index.html             159 B     3.96s

Oha, then it's the operating system? I use Windows 10.

Otherwise, as I said, I have done nothing else than:

  1. download project from sandbox
  2. unzip
  3. yarn install
  4. yarn build

If it works correctly for other Windows users (can anyone confirm that?), I unfortunately have no idea why.

Oha, then it's the operating system? I use Windows 10.

Can confirm, that this happens on Windows 10 and not on macOS.
Interestingly, the tree shaking test suite is currently disabled on Windows...

I'm not completely sure why, but https://github.com/parcel-bundler/parcel/pull/2445 fixed your issue (December 24th, 2018). So it will be fixed in the next release

Interestingly, the tree shaking test suite is currently disabled on Windows...

This has nothing to do with this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devongovett picture devongovett  ยท  3Comments

davidnagli picture davidnagli  ยท  3Comments

jzimmek picture jzimmek  ยท  3Comments

will-stone picture will-stone  ยท  3Comments

dsky1990 picture dsky1990  ยท  3Comments