2018-09-25 15:05:21 +00:00
|
|
|
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'
|
2018-10-21 17:06:04 +00:00
|
|
|
},
|
|
|
|
{
|
2018-11-13 10:57:45 +00:00
|
|
|
from: /^\/publicodes\/.*$|^\/publicodes$/,
|
2018-10-21 17:06:04 +00:00
|
|
|
to: '/publicodes.html'
|
2018-09-25 15:05:21 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
// 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')
|
|
|
|
})
|