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 with react-intl library makes bundle even bigger #1859

Closed
PutziSan opened this issue Aug 7, 2018 · 6 comments
Closed

Tree-Shaking with react-intl library makes bundle even bigger #1859

PutziSan opened this issue Aug 7, 2018 · 6 comments

Comments

@PutziSan
Copy link

PutziSan commented Aug 7, 2018

🐛 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
@mischnic
Copy link
Member

Do you this still have this issue?

@PutziSan
Copy link
Author

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

@mischnic
Copy link
Member

mischnic commented Jan 13, 2019

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

@PutziSan
Copy link
Author

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.

@mischnic
Copy link
Member

mischnic commented Jan 13, 2019

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...

@mischnic
Copy link
Member

I'm not completely sure why, but #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.

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

No branches or pull requests

3 participants