Skip to content

Commit

Permalink
added node env production setting for smaller builds
Browse files Browse the repository at this point in the history
  • Loading branch information
prakhar1989 committed Jul 30, 2015
1 parent 7f7e15d commit 4861212
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -5,7 +5,7 @@
"main": "./lib/app.js",
"scripts": {
"start": "node node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --colors --port 8090",
"build": "webpack -p",
"build": "NODE_ENV='production' webpack -p",
"test": "mocha --compilers js:babel/register tests",
"lint": "node node_modules/eslint/bin/eslint.js js"
},
Expand Down
10 changes: 7 additions & 3 deletions webpack.config.js
@@ -1,6 +1,12 @@
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

var plugins = [ new ExtractTextPlugin("build/styles.min.css", { allChunks: true }) ];

if (process.env.NODE_ENV === "production") {
plugins.push( new webpack.DefinePlugin({'process.env': {NODE_ENV: '"production"'}}) );
}

module.exports = {
entry: "./js/app.js",
module: {
Expand All @@ -16,9 +22,7 @@ module.exports = {
}
]
},
plugins: [
new ExtractTextPlugin("build/styles.min.css", { allChunks: true })
],
plugins: plugins,
output: {
filename: "build/bundle.js"
}
Expand Down

0 comments on commit 4861212

Please sign in to comment.