Skip to content

Commit d23f7ce

Browse files
author
Geoff Davis
committed
add uglification preset/script
1 parent e502a6f commit d23f7ce

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.babelrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"plugins": ["transform-flow-strip-types"]
2+
"plugins": ["transform-flow-strip-types"],
3+
"presets": ["es2015"]
34
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"license": "MIT",
88
"scripts": {
99
"start": "webpack --watch",
10+
"build": "DIST=true webpack",
1011
"lint": "eslint source",
1112
"flow": "flow check",
1213
"flow:init": "flow",

webpack.config.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
'use strict';
2+
const webpack = require('webpack'),
3+
isDIST = process.env.DIST,
4+
uglifyConfig = {
5+
cacheFolder: __dirname
6+
};
7+
8+
console.log(isDIST === 'true')
29
module.exports = {
310
entry: './source/index.js',
411
output: {
512
path: __dirname+'/dist',
6-
filename: 'index.js'
13+
filename: `index.${isDIST === 'true' ? 'min.' : ''}js`
714
},
815
module: {
916
loaders: [
1017
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }
1118
]
12-
}
19+
},
20+
plugins: [
21+
(isDIST === 'true' ? new webpack.optimize.UglifyJsPlugin() : null)
22+
]
1323
};

0 commit comments

Comments
 (0)