Skip to content

Conversation

@KyleAMathews
Copy link
Contributor

No description provided.

@gatsbybot
Copy link
Collaborator

gatsbybot commented Mar 21, 2017

Deploy preview ready!

Built with commit 4ecdbb6

https://deploy-preview-746--gatsbyjs.netlify.com

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 4575c38

https://deploy-preview-746--gatsbygram.netlify.com

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 4ecdbb6

https://deploy-preview-746--gatsbygram.netlify.com

@KyleAMathews
Copy link
Contributor Author

So apparently webpack's commonsChunkPlugin's minChunk option takes a function... which makes it way easier to control what goes in the commons.js bundle. Previously the minChunk option just had an int meaning if a module was in a certain number of bundles then it should be extracted into the commons bundle instead. Which mostly works but by was inconsistent as for some sites, framework code wouldn't end up in the commons bundle. Also weirdly, it was causing the app.js bundle to balloon to enormous size. When I examined it with source-map-explorer, the react-dom was taking up ~500kb of space. With this, it's now taking up ~125kb of uncompressed space in commons.js as expected. Not sure what happened there.

Currently we consider framework modules to be react, react-dom, react-router, history, react-router-scroll. This list should be kept up-to-date as we move around things in core.

Another question is should we have an explicit framework bundle e.g. gatsby.js? My main reason not to is we're already loading 4 js bundles in parallel when loading a page (commons.js, app.js, the page's template bundle and data bundle). Which is running up against browsers parallel downloads limits.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants