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

Speed up npm bundle builds #775

Merged
merged 3 commits into from
Dec 16, 2015
Merged

Speed up npm bundle builds #775

merged 3 commits into from
Dec 16, 2015

Conversation

davkal
Copy link
Contributor

@davkal davkal commented Dec 16, 2015

  • Use include option to point to app sources (reduces by 33%)
  • Try extracting vendor modules into own bundle
  • Have app, terminal-app, and common bundles

@davkal davkal changed the title [WIP] Speed up npm bundle builds Speed up npm bundle builds Dec 16, 2015
@foot
Copy link
Contributor

foot commented Dec 16, 2015

Niccee, I get ~40s -> ~30s 👍

Turning sourceMaps off[0] gets another 5s, so down to about ~25s. Do they get used? I haven't had to debug anything in a prod env yet :).

diff --git a/client/webpack.production.config.js b/client/webpack.production.config.js
index 89744be..8072589 100644
--- a/client/webpack.production.config.js
+++ b/client/webpack.production.config.js
@@ -74,6 +74,7 @@ module.exports = {
     new webpack.DefinePlugin(GLOBALS),
     new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
     new webpack.optimize.UglifyJsPlugin({
+      sourceMap: false,
       compress: {
         warnings: false
       }

@foot
Copy link
Contributor

foot commented Dec 16, 2015

Everything seems to still be working in dev/prod local/container.

LGTM

@davkal
Copy link
Contributor Author

davkal commented Dec 16, 2015

The sourceMap: false option in uglify gives me this error

ERROR in vendors.js from UglifyJs
TypeError: Cannot read property 'sections' of null
    at new SourceMapConsumer (/Users/david/weave/src/github.com/weaveworks/scope/client/node_modules/webpack-core/node_modules/source-map/lib/source-map/source-map-consumer.js:24:21)
    at /Users/david/weave/src/github.com/weaveworks/scope/client/node_modules/webpack/lib/optimize/UglifyJsPlugin.js:62:23

@davkal
Copy link
Contributor Author

davkal commented Dec 16, 2015

Turns out, it tried to uglify twice if -p was given. Now included sourceMaps: false.

davkal added a commit that referenced this pull request Dec 16, 2015
@davkal davkal merged commit 4ea8545 into master Dec 16, 2015
@davkal davkal deleted the build-performance branch December 16, 2015 17:54
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.

2 participants