mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(webpack) turn of uglify when NODE_ENV=debug
This commit is contained in:
parent
1b1f2b0bb1
commit
56882ee489
1 changed files with 13 additions and 9 deletions
|
|
@ -12,6 +12,18 @@ const isDebug = env.NODE_ENV === 'debug';
|
|||
const dist = path.resolve(__dirname, 'dist');
|
||||
const distDebug = path.resolve(__dirname, 'dist-debug');
|
||||
const devtool = isDebug ? 'eval' : 'source-map';
|
||||
const notEmpty = (a) => a;
|
||||
const clean = (array) => array.filter(notEmpty);
|
||||
|
||||
const plugins = clean([
|
||||
!isDebug && new UglifyJsPlugin({
|
||||
sourceMap: true
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'cloudcmd',
|
||||
filename: 'cloudcmd.js',
|
||||
}),
|
||||
]);
|
||||
|
||||
module.exports = {
|
||||
devtool,
|
||||
|
|
@ -38,15 +50,7 @@ module.exports = {
|
|||
path: isDebug ? distDebug : dist,
|
||||
libraryTarget: 'umd'
|
||||
},
|
||||
plugins: [
|
||||
new UglifyJsPlugin({
|
||||
sourceMap: true
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'cloudcmd',
|
||||
filename: 'cloudcmd.js',
|
||||
}),
|
||||
],
|
||||
plugins,
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.js$/,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue