parent
91f51cea9e
commit
af662c4834
|
@ -61,7 +61,7 @@
|
|||
"prepare": "flow-typed update-cache",
|
||||
"serve:infrance": "cp dist/infrance.html dist/index.html && serve -s dist",
|
||||
"pretest": "LIST=`git diff --name-only --diff-filter=AMR HEAD^..HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi && flow check",
|
||||
"start": "webpack-serve ./source/webpack.dev.js",
|
||||
"start": "node source/server.js",
|
||||
"test-inversions": "yarn test-watch --grep 'inversions'",
|
||||
"test-meca": "yarn test-watch --grep 'Mécanismes'",
|
||||
"test-rules": "yarn test-watch --grep 'notre base de règles'",
|
||||
|
@ -104,6 +104,7 @@
|
|||
"eslint-config-prettier": "^3.0.1",
|
||||
"eslint-plugin-flowtype": "^2.46.3",
|
||||
"eslint-plugin-react": "^7.11.1",
|
||||
"express": "^4.16.3",
|
||||
"file-loader": "^1.1.11",
|
||||
"flow-bin": "^0.72.0",
|
||||
"flow-typed": "^2.4.0",
|
||||
|
@ -131,10 +132,9 @@
|
|||
"url-loader": "^1.0.1",
|
||||
"webpack": "^4.17.1",
|
||||
"webpack-cli": "^3.0.8",
|
||||
"webpack-dev-middleware": "^3.4.0",
|
||||
"webpack-hot-middleware": "^2.24.2",
|
||||
"webpack-pwa-manifest": "^3.6.2",
|
||||
"webpack-serve": "^2.0.2",
|
||||
"webpack-serve-overlay": "^0.2.2",
|
||||
"webpack-serve-waitpage": "^1.0.2",
|
||||
"workbox-webpack-plugin": "^3.3.1",
|
||||
"yaml-loader": "^0.5.0"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
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')
|
||||
})
|
|
@ -1,47 +1,14 @@
|
|||
const { map, concat } = require('ramda')
|
||||
const webpack = require('webpack')
|
||||
const common = require('./webpack.common.js')
|
||||
const webpackServeWaitpage = require('webpack-serve-waitpage')
|
||||
const history = require('connect-history-api-fallback')
|
||||
const convert = require('koa-connect')
|
||||
|
||||
module.exports = {
|
||||
...common,
|
||||
mode: 'development',
|
||||
entry: map(concat(['react-hot-loader/patch']), common.entry),
|
||||
serve: {
|
||||
host: '0.0.0.0',
|
||||
hotClient: {
|
||||
allEntries: true,
|
||||
host: { client: '*', server: '0.0.0.0' }
|
||||
},
|
||||
add: (app, middleware, options) => {
|
||||
app.use(
|
||||
convert(
|
||||
history({
|
||||
rewrites: [
|
||||
{
|
||||
from: /^\/embauche\/.*$|^\/embauche$/,
|
||||
to: '/embauche.html'
|
||||
},
|
||||
{
|
||||
from: /^\/infrance\/.*$|^\/infrance$/,
|
||||
to: '/infrance.html'
|
||||
}
|
||||
]
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
app.use(
|
||||
webpackServeWaitpage(options, {
|
||||
theme: 'material'
|
||||
})
|
||||
)
|
||||
}
|
||||
},
|
||||
entry: map(concat(['webpack-hot-middleware/client']), common.entry),
|
||||
plugins: [
|
||||
...common.plugins,
|
||||
new webpack.EnvironmentPlugin({ NODE_ENV: 'development' })
|
||||
new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
|
||||
new webpack.HotModuleReplacementPlugin()
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue