Skip to content

Commit

Permalink
Optimize javascript file size in production
Browse files Browse the repository at this point in the history
  • Loading branch information
boivie committed Jun 17, 2016
1 parent 50fc210 commit 2ddcce2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dashboard/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ assets.go: $(ASSETS) assets/bundle.js
$(GO_BINDATA) $(BINDATA_DEBUG) -pkg=dashboard -prefix "assets/" -o assets.go assets/...

assets/bundle.js: node_modules/webpack/bin/webpack.js $(JS_FILES)
./node_modules/webpack/bin/webpack.js
./node_modules/webpack/bin/webpack.js --production

node_modules/webpack/bin/webpack.js:
npm install
13 changes: 12 additions & 1 deletion dashboard/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,16 @@ module.exports = {
},
resolve: {
extensions: ['', '.js', '.jsx']
}
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production'),
}
}),
new webpack.optimize.UglifyJsPlugin()
]
};

0 comments on commit 2ddcce2

Please sign in to comment.