mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 17:32:31 +00:00
fix(server): Cannot read property client of null when webpackHMR & restarting Nuxt
This commit is contained in:
parent
431cc15617
commit
8a200f7e91
@ -84,10 +84,10 @@ export default class Server {
|
|||||||
this.useMiddleware(modernMiddleware)
|
this.useMiddleware(modernMiddleware)
|
||||||
this.useMiddleware(async (req, res, next) => {
|
this.useMiddleware(async (req, res, next) => {
|
||||||
const name = req.modernMode ? 'modern' : 'client'
|
const name = req.modernMode ? 'modern' : 'client'
|
||||||
if (this.devMiddleware[name]) {
|
if (this.devMiddleware && this.devMiddleware[name]) {
|
||||||
await this.devMiddleware[name](req, res)
|
await this.devMiddleware[name](req, res)
|
||||||
}
|
}
|
||||||
if (this.hotMiddleware[name]) {
|
if (this.hotMiddleware && this.hotMiddleware[name]) {
|
||||||
await this.hotMiddleware[name](req, res)
|
await this.hotMiddleware[name](req, res)
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
|
Loading…
Reference in New Issue
Block a user