-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.dev.js
55 lines (48 loc) · 1.31 KB
/
webpack.config.dev.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
const _ = require('lodash')
const webpack = require('webpack')
const config = require('./webpack.config.base.js')
// Use port ( if you change this adapt code in Html.jsx as well )
const dev_port = 8080
// Merge with base configuration
//-------------------------------
_.merge(config, {
cache: true,
devtool: 'source-map',
entry: {
bundle: [
//'webpack/hot/dev-server',
'webpack-dev-server/client?http://localhost:8080/',
config.entry
]
}
})
// Setup webpack for DEV
//-------------------------------
const compiler = webpack(config)
const compilerConfig = {
contentBase: 'build',
filename: 'bundle.js',
compress: true,
watchOptions: {
poll: true,
aggregateTimeout: 500,
ignore: /node_modules|data|build|\.git/
},
stats: {
colors: true,
version: false,
hash: false,
timings: false,
chunks: false,
chunkModules: false
}
}
// Launch DEV server
//-------------------------------
console.info('webpack: running dev build...')
const WebpackDevServer = require('webpack-dev-server')
const server = new WebpackDevServer(compiler, compilerConfig)
server.listen(dev_port, function() {
console.info(`webpack: dev server running on port ${dev_port}`)
})
module.exports = config