mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
[webpack] set up proper dev/prod environment (#916)
This commit is contained in:
parent
baf22c3c60
commit
08d682501e
@ -8,8 +8,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run lint && mocha --compilers js:babel-core/register --required spec/helpers/browser.js spec/**/*_spec.*",
|
"test": "npm run lint && mocha --compilers js:babel-core/register --required spec/helpers/browser.js spec/**/*_spec.*",
|
||||||
"dev": "webpack -d --watch --colors",
|
"dev": "NODE_ENV=dev webpack -d --watch --colors",
|
||||||
"prod": "webpack -p --colors",
|
"prod": "NODE_ENV=production webpack -p --colors",
|
||||||
"lint": "npm run --silent lint:js",
|
"lint": "npm run --silent lint:js",
|
||||||
"lint:js": "eslint --ignore-path=.eslintignore --ext .js ."
|
"lint:js": "eslint --ignore-path=.eslintignore --ext .js ."
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
const webpack = require('webpack');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
// input dir
|
// input dir
|
||||||
@ -104,6 +105,15 @@ const config = {
|
|||||||
'react/lib/ExecutionEnvironment': true,
|
'react/lib/ExecutionEnvironment': true,
|
||||||
'react/lib/ReactContext': 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;
|
module.exports = config;
|
||||||
|
Loading…
Reference in New Issue
Block a user