-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev_server.js
33 lines (31 loc) · 927 Bytes
/
dev_server.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
const Webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const webpackConfig = require('./webpack.config')
const fs = require('fs')
const path = require('path')
var merge = require('webpack-merge');
const port = 8800
const config = merge(webpackConfig, {
entry: ['webpack-dev-server/client?http://localhost:8800/', 'webpack/hot/dev-server'],
plugins: [
new Webpack.HotModuleReplacementPlugin()
],
devtool: 'source-map',
mode: 'development'
})
const compiler = Webpack(config)
const server = new WebpackDevServer(compiler, {
disableHostCheck: true,
hot: true,
publicPath: config.output.publicPath,
historyApiFallback: true,
contentBase: 'app',
stats: {
colors: true
}
}).listen(port, "localhost", function (err, result) {
if (err) {
console.log(err)
}
console.log(`Listening at http://localhost:${port}/`)
});