-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
82 lines (81 loc) · 2.32 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var webpack = require('webpack')
var CleanPlugin = require('clean-webpack-plugin')
var ExtractPlugin = require('extract-text-webpack-plugin')
var path = require('path')
// plugins
plugins = [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'main',
children: true,
minChunks: 2
}),
new webpack.HotModuleReplacementPlugin(),
]
module.exports = {
debug: true,
entry: [
'webpack-dev-server/client?http://0.0.0.0:3000',
'webpack/hot/only-dev-server',
'./src/client.jsx'
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel?presets[]=react,presets[]=es2015']
}, {
test: /\.css$/,
loaders: ["style", "css"]
}, {
test: /\.less$/,
loaders: ["style", "css", 'less']
}, {
test: /\.(ttf|eot|woff(2)?)(\?(t=)?[a-z0-9]+)?$/,
loader: 'url?limit=50000&hash=sha512&digest=hex&name=[hash].[ext]'
}, {
test: /\.(svg?)(\?(t=)?[a-z0-9]+)$/,
loader: 'url?limit=50000&hash=sha512&digest=hex&name=[hash].[ext]'
}, {
test: /\.svg$/,
loader: 'svg-inline'
}, {
test: /\.(jpe?g|png|gif)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false',
]
},
{
test: /\.json$/,
loader: 'json'
}, {
test: /\.mp3$/,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
]
}
]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
output: {
path: __dirname + '/dist',
publicPath: '/',
filename: 'bundle.js'
},
devServer: {
contentBase: './dist',
hot: true,
headers: {
"Access-Control-Allow-Origin": "*"
},
historyApiFallback: true
},
node: {
child_process: 'empty'
},
plugins: plugins,
devtool: 'eval',
}