You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
865 B
27 lines
865 B
import { Express } from "express"; |
|
import * as webpack from "webpack"; |
|
import * as webpackMiddleware from "webpack-dev-middleware"; |
|
import * as webpackHotMiddleware from "webpack-hot-middleware"; |
|
|
|
import logger from "../../common/logger"; |
|
const log = logger.child({ source: "webpack" }); |
|
|
|
/* tslint:disable-next-line:no-var-requires */ |
|
const webpackConfig = require("../../app/webpack/config.js"); |
|
|
|
export default function serveApp(app: Express) { |
|
const compiler = webpack(webpackConfig); |
|
app.use(webpackMiddleware(compiler, |
|
{ |
|
noInfo: true, |
|
publicPath: webpackConfig.output.publicPath, |
|
log: log.info.bind(log), |
|
warn: log.warn.bind(log), |
|
error: log.error.bind(log), |
|
}, |
|
)); |
|
app.use(webpackHotMiddleware(compiler, |
|
{ |
|
log: log.info.bind(log), |
|
})); |
|
}
|
|
|