forked from catalsdevelop/flextracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
56 lines (54 loc) · 1.08 KB
/
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
52
53
54
55
56
var path = require('path')
var webpack = require('webpack')
var merge = require('webpack-merge')
var env = process.env.NODE_ENV
var base = {
entry: {
tracker: './src/index.js'
},
output: {
path: './dist',
filename: '[name].js'
},
resolve: {
extensions: ['', '.js'],
fallback: [path.join(__dirname, '../node_modules')],
},
plugins: [
new webpack.DefinePlugin({
'process.env': '\''+ env + '\''
}),
]
}
switch (env) {
case 'production':
module.exports = merge(base, {
output: {
filename: '[name].min.js'
},
devtool: '#source-map',
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
]
})
break
case 'test':
module.exports = merge(base, {
devtool: '#inline-source-map',
module: {
preLoaders: [{
test: /\.js$/,
loader: 'isparta',
include: path.resolve(__dirname, 'src')
}]
},
})
break
case 'development' :
module.exports = base
break
}