-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevServer.js
More file actions
executable file
·39 lines (31 loc) · 995 Bytes
/
Copy pathdevServer.js
File metadata and controls
executable file
·39 lines (31 loc) · 995 Bytes
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
var express = require('express')
var path = require('path')
var webpack = require('webpack')
var config = require('./webpack.config.dev')
var historyApiFallback = require('connect-history-api-fallback')
var app = express()
var compiler = webpack(config)
// Has to be used twice
// https://github.com/webpack/webpack-dev-middleware/pull/44
app.use(historyApiFallback())
app.use(require('webpack-dev-middleware')(compiler, {
publicPath: config.output.publicPath,
contentBase: 'src',
stats: {
colors: true,
hash: false,
timings: true,
chunks: false,
chunkModules: false,
modules: false
}
}))
app.use(historyApiFallback())
app.use(require('webpack-hot-middleware')(compiler))
app.use(express.static(path.join(__dirname, '/dist')))
app.listen(config._hotPort, 'localhost', function (err) {
if (err) {
console.log(err)
}
console.info('==> 🌎 Listening on port %s. Open up http://localhost:%s/ in your browser.', config._hotPort, config._hotPort)
})