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

0.10 prerelease with webpack 2 increases bundle size #1843

Closed
gavinwahl opened this issue Mar 17, 2017 · 9 comments
Closed

0.10 prerelease with webpack 2 increases bundle size #1843

gavinwahl opened this issue Mar 17, 2017 · 9 comments

Comments

@gavinwahl
Copy link

On a newly created empty project and [email protected], I get these bundle sizes for the production build after running yarn run build:

  46.12 KB  build/static/js/main.fcaea709.js
  289 B     build/static/css/main.9a0fe4f1.css

After upgrading to the 0.10.0 alpha (328cb32), I get:

  46.28 KB (+163 B)  build/static/js/main.f27b292b.js
  317 B (+28 B)      build/static/css/main.1f6b6bee.css

I expect the bundle size not to increase after upgrading. In my production project, I get an even larger increase:

  268.18 KB (+2.22 KB)  build/static/js/main.1d20828f.js
  32.15 KB (+4.9 KB)    build/static/css/main.0d46d1be.css
@Timer
Copy link
Contributor

Timer commented Mar 17, 2017

Part of the reason is because of webpack/webpack#4493. I'm not sure why the existing build is growing so much ... probably the same reason (I'd hope).

Can you look at this with source-map-explorer as explained in #1641?

Unfortunately we cannot leverage tree-shaking yet (and are using babel to compile to commonjs) because sourcemaps are broken (webpack/webpack#4423), and tree-shaking actually doesn't work at all (webpack/webpack#2867, webpack/webpack#2899, webpack/webpack#3092).

@Timer Timer added this to the 0.10.0 milestone Mar 17, 2017
@gavinwahl
Copy link
Author

0.9.5:
0.9.5

0.10.0:
0.10.0

Now I'm confused...source-ma-explorer is reporting the 0.10.0 as smaller...maybe it got less compressible?

@Timer
Copy link
Contributor

Timer commented Mar 17, 2017

Interesting... I wonder if webpack 1 vs 2 have different versions of uglify and there was a regression on that front...

Unless if we regressed in our configuration.

@Timer
Copy link
Contributor

Timer commented Mar 17, 2017

Maybe the default configuration changed, can you try some of the options in #1644? You can edit the config file in your node_modules.

@gaearon
Copy link
Contributor

gaearon commented Mar 17, 2017

I'd be surprised if it was Uglify. I suspect some polyfill we happen to bundle (e.g. process) got larger, something changed at module boundaries, or some pattern got harder to uglify (e.g. something that used to repeat in Webpack 1 is now unique every time defeating compression in Webpack 2).

Need to look at minimal bundles from both. Also at minimal bundles without React for both.

@AJamesPhillips
Copy link
Contributor

AJamesPhillips commented Mar 21, 2017

I don't know if it's useful but I marked up a few of the differences on 0.10.0. lodash appears to be included twice (two large purple boxes), I'm not certain what's going on there. Generally all parts in 0.10.0 are smaller by up to a couple of kb but there were some exceptions (significant decrease (green), no change (blue), increase(red)) and some name changes from lib to es or Nnn to Nnn-es (purple smaller boxes).

wb2

@watert
Copy link

watert commented Apr 11, 2017

@AJamesPhillips how is this log printed? seems great.

@AJamesPhillips
Copy link
Contributor

AJamesPhillips commented Apr 11, 2017

@watert I just took the screen shots from gavinwahl's posts above. He might have followed the instructions Timer link to in his comment.

@Timer Timer modified the milestones: 0.10.1, 0.10.0 May 14, 2017
@gaearon gaearon modified the milestones: 1.0.1, 1.0.x May 19, 2017
@Timer
Copy link
Contributor

Timer commented Aug 2, 2017

Closing this as unactionable by us; webpack updated its node stubs which are now larger -- we've actually removed some of these stubs by default now so your bundle might have shrunk.

Feel free to open a new issue if someone has something compelling.

@Timer Timer closed this as completed Aug 2, 2017
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
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

5 participants