forked from binary-com/binary-bot
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
53 lines (51 loc) · 1.29 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
import webpack from 'webpack'
import path from 'path'
const production = process.env.NODE_ENV === 'production'
module.exports = {
devtool: 'cheap-module-source-map',
watch: !production,
module: {
noParse: ['ws'],
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loaders: [
'babel?presets[]=react,presets[]=es2015,presets[]=stage-0',
], // 'babel-loader' is also a legal name to reference
},
{
test: /\.json$/,
exclude: /(node_modules|bower_components)/,
loader: 'json',
},
],
},
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
entry: {
bot: ['babel-polyfill', path.join(__dirname, 'src', 'botPage')],
index: path.join(__dirname, 'src', 'indexPage'),
},
externals: ['ws'],
output: {
filename: production ? '[name].min.js' : '[name].js',
sourceMapFilename: production ? '[name].min.js.map' : '[name].js.map',
},
plugins: production && [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
include: /\.js$/,
minimize: true,
sourceMap: true,
compress: {
warnings: false,
},
}),
],
}