-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
54 lines (54 loc) · 1.64 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
var webpack = require('webpack'),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
path = require('path'),
ip = require('ip'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
ROOT_PATH = path.resolve(__dirname),
APP_PATH = path.resolve(ROOT_PATH, 'src');
module.exports = {
entry: [
'webpack-hot-middleware/client',
APP_PATH
],
output: {
path: path.join(__dirname, '/build/'),
filename: 'build/[name].[hash:4].js',
chunkFilename: 'build/chunk.[id].[hash:4].js',
publicPath: '/'
},
module: {
loaders: [ {
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: ['babel?optional=runtime&stage=0']
}]
},
resolve: {
modulesDirectories: [
'src',
'node_modules',
],
extensions: ['', '.js', '.png']
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
inject: 'body',
template: "src/index.tpl.html"
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin({
minSizeReduce: 1.5,
moveToParents: true
}),
new webpack.DefinePlugin({
'process.env.BROWSER': JSON.stringify(true),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.CHAPTER': JSON.stringify(process.env.CHAPTER)
})
],
devtool: 'source-map'
};