fix(server): Cannot read property client of null when webpackHMR & restarting Nuxt

This commit is contained in:
Sébastien Chopin 2018-12-11 16:20:44 +01:00
parent 431cc15617
commit 8a200f7e91

View File

@ -84,10 +84,10 @@ export default class Server {
this.useMiddleware(modernMiddleware)
this.useMiddleware(async (req, res, next) => {
const name = req.modernMode ? 'modern' : 'client'
if (this.devMiddleware[name]) {
if (this.devMiddleware && this.devMiddleware[name]) {
await this.devMiddleware[name](req, res)
}
if (this.hotMiddleware[name]) {
if (this.hotMiddleware && this.hotMiddleware[name]) {
await this.hotMiddleware[name](req, res)
}
next()