-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·62 lines (58 loc) · 1.65 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
57
58
59
60
61
62
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');
var config = {
dev: {
devtool: 'sourcemaps',
entry: [
'./client/js/app'
],
output: {
path: path.join(__dirname, 'public/js'),
filename: 'bundle.js',
publicPath: '/static/js/',
historyApiFallback: true,
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
// new webpack.HotModuleReplacementPlugin()
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /(node_modules|bower_components)/,
include: __dirname
}
]
}
},
production: {
devtool: null,
entry: [
'./client/js/app'
],
output: {
path: path.join(__dirname, 'public/js'),
filename: 'bundle-[hash].min.js',
publicPath: '/static/js/'
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false })
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /(node_modules|bower_components)/,
include: __dirname
}
]
}
}
};
module.exports = debug ? config.dev : config.production;