-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
51 lines (48 loc) · 1016 Bytes
/
webpack.config.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
const merge = require('webpack-merge')
const webpack = require('webpack')
const TARGET = process.env.npm_lifecycle_event
process.env.BABEL_ENV = TARGET
const common = {
entry: {
app: './index.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
output: {
filename: 'bundle.js',
publicPath: ''
},
externals: {
},
plugins: [
new webpack.NoErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.UglifyJsPlugin({minimize: true})
],
module: {
loaders: [
{
test: /\.css$/,
loaders: ['style', 'css']
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
},
{
test: /\.js?$/,
loaders: ['babel-loader?presets[]=es2015&presets[]=react'],
exclude: /node_modules/
}
]
}
}
if (TARGET === 'start' || !TARGET) {
module.exports = merge(common, {
devtool: 'eval-source-map'
})
}
if (TARGET === 'build') {
module.exports = merge(common, {})
}