1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-08 23:25:02 +00:00
mon-entreprise/source/server.js
Mael af662c4834 Retour à webpack-dev-server
webpack-serve est déprécié
2018-09-25 15:07:41 +00:00

38 lines
847 B
JavaScript

const express = require('express')
const webpack = require('webpack')
const webpackDevMiddleware = require('webpack-dev-middleware')
const app = express()
const config = require('./webpack.dev.js')
const compiler = webpack(config)
const history = require('connect-history-api-fallback')
app.use(
history({
rewrites: [
{
from: /^\/embauche\/.*$|^\/embauche$/,
to: '/embauche.html'
},
{
from: /^\/infrance\/.*$|^\/infrance$/,
to: '/infrance.html'
}
]
})
)
// Tell express to use the webpack-dev-middleware and use the webpack.config.js
// configuration file as a base.
app.use(
webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
hot: true
})
)
app.use(require('webpack-hot-middleware')(compiler))
app.listen(8080, function() {
console.log('Example app listening on port 8080!\n')
})