-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·110 lines (106 loc) · 2.46 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
var path = require('path')
var webpack = require('webpack')
var outputPath = path.resolve(__dirname, './.tmp/static/dist')
var host = process.env.HOST || 'localhost'
var port = parseInt(process.env.PORT, 10) || 3001
module.exports = {
target: 'web',
devtool: 'source-map',
entry: {
'main': [
'react-hot-loader/patch',
'webpack-hot-middleware/client?path=http://' + host + ':' + port + '/__webpack_hmr',
'./src/client/main.js'
]
},
output: {
path: outputPath,
filename: '[name].js',
chunkFilename: '[name]-[id].js',
publicPath: 'http://' + host + ':' + port + '/dist/'
},
module: {
rules: [{
test: /\.js$/,
exclude: path.join(__dirname, 'node_modules'),
use: [{
loader: 'babel-loader'
}]
}, {
test: /\.html$/,
exclude: path.join(__dirname, 'node_modules'),
use: [{
loader: 'html-loader'
}]
}, {
test: /\.ya?ml$/,
exclude: path.join(__dirname, 'node_modules'),
use: [{
loader: 'json-loader'
}, {
loader: 'yaml-loader'
}]
}, {
test: /\.css$/,
exclude: path.join(__dirname, 'node_modules'),
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader',
options: {
importLoaders: 1
}
}, {
loader: 'postcss-loader'
}]
}, {
test: /\.(jpe?g|png|gif)$/i,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
hash: 'sha512',
digest: 'hex',
name: '[hash].[ext]'
}
}]
}, {
test: /\.woff(2)?(\?.*)?$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
minetype: 'application/font-woff'
}
}]
}, {
test: /\.(ttf|eot|svg)(\?.*)?$/,
use: [{
loader: 'file-loader'
}]
}]
},
resolve: {
modules: [
'src/client',
'node_modules'
],
extensions: ['.json', '.js'],
alias: {
'socket.io-client': 'socket.io-client/dist/socket.io.js'
}
},
plugins: [
new webpack.DllReferencePlugin({
context: './src/client',
manifest: require('./dll/vendors-manifest.json')
}),
// hot reload
new webpack.HotModuleReplacementPlugin(),
new webpack.IgnorePlugin(/\.json$/),
new webpack.DefinePlugin({
__DEVELOPMENT__: true
}),
new webpack.optimize.CommonsChunkPlugin({name: 'commons', filename: 'commons.js'})
]
}