-
Notifications
You must be signed in to change notification settings - Fork 229
/
webpack.config.babel.js
64 lines (60 loc) · 1.55 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
59
60
61
62
63
64
import webpack from 'webpack'
const Path = require('path')
export default {
entry: [
'babel-polyfill',
'./src/index.js'
],
output: {
path: Path.resolve(__dirname, 'dist'),
filename: 'index.js',
chunkFilename: '[name].js'
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.css$/, loader: 'style-loader!css-loader!postcss-loader' },
{ test: /\.json$/, loader: 'json' }
]
},
plugins: [
// https://github.com/postcss/postcss-loader/issues/99
new webpack.LoaderOptionsPlugin({
test: /\.css$/,
options: {
postcss: (webpackInstance) => [
require('postcss-import')({ addDependencyTo: webpackInstance }),
require('precss')()
],
context: __dirname,
},
}),
...process.env.NODE_ENV === 'production' ? [
new webpack.LoaderOptionsPlugin({ minimize: false, debug: false }),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
screw_ie8: true,
sequences: true,
dead_code: true,
drop_debugger: true,
comparisons: true,
conditionals: true,
evaluate: true,
booleans: true,
loops: true,
unused: true,
hoist_funs: true,
if_return: true,
join_vars: true,
cascade: true,
drop_console: true
},
output: {
comments: false
}
})
] : [],
]
}