-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.babel.js
58 lines (52 loc) · 1.12 KB
/
webpack.config.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import path from 'path';
import webpack from 'webpack';
const mainPath = path.resolve(__dirname, 'src', 'index.js');
const buildPath = path.resolve(__dirname, 'dist');
const config = {
entry: {
bundle: [mainPath]
},
output: {
path: buildPath,
filename: 'index.js',
publicPath: '/dist/',
libraryTarget: "commonjs2"
},
externals: ["external"],
resolve: {
extensions: ['.js']
},
module: {
loaders: [
{
test: /\.js?$/,
include: [path.resolve('src')],
loader: 'babel-loader'
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.UglifyJsPlugin({
output: {
comments: 0
},
sourceMap: false,
compress: {
unused: 1,
warnings: 1,
comparisons: 1,
conditionals: 1,
negate_iife: 1, // <- for `LazyParseWebpackPlugin()`
dead_code: 1,
if_return: 1,
join_vars: 1,
evaluate: 1
}
})
]
};
module.exports = config;