mirror of https://github.com/apache/superset.git
[webpack] set up proper dev/prod environment (#916)
This commit is contained in:
parent
baf22c3c60
commit
08d682501e
|
@ -8,8 +8,8 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": "npm run lint && mocha --compilers js:babel-core/register --required spec/helpers/browser.js spec/**/*_spec.*",
|
||||
"dev": "webpack -d --watch --colors",
|
||||
"prod": "webpack -p --colors",
|
||||
"dev": "NODE_ENV=dev webpack -d --watch --colors",
|
||||
"prod": "NODE_ENV=production webpack -p --colors",
|
||||
"lint": "npm run --silent lint:js",
|
||||
"lint:js": "eslint --ignore-path=.eslintignore --ext .js ."
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
|
||||
// input dir
|
||||
|
@ -104,6 +105,15 @@ const config = {
|
|||
'react/lib/ExecutionEnvironment': true,
|
||||
'react/lib/ReactContext': true,
|
||||
},
|
||||
plugins: [],
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
|
||||
}
|
||||
module.exports = config;
|
||||
|
|
Loading…
Reference in New Issue