From 3d89c2671256a108c60e4ebfd92b2fc94acee7a9 Mon Sep 17 00:00:00 2001 From: yaou Date: Thu, 29 Apr 2021 10:53:53 +0800 Subject: [PATCH 1/2] fix the error of missing res.end function --- middleware/hotMiddleware.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/middleware/hotMiddleware.js b/middleware/hotMiddleware.js index a5f96ba..149bc83 100644 --- a/middleware/hotMiddleware.js +++ b/middleware/hotMiddleware.js @@ -1,6 +1,8 @@ import hotMiddleware from 'webpack-hot-middleware' import { PassThrough } from 'stream' +const noop = () => {} + export default (compiler, opts) => { const expressMiddleware = hotMiddleware(compiler, opts) return async (ctx, next) => { @@ -11,7 +13,8 @@ export default (compiler, opts) => { writeHead: (status, headers) => { ctx.status = status ctx.set(headers) - } + }, + res: noop }, next) } } From 5390038213f31f37aab003aab984887444a8388d Mon Sep 17 00:00:00 2001 From: yaou Date: Thu, 29 Apr 2021 11:10:22 +0800 Subject: [PATCH 2/2] fix the name --- middleware/hotMiddleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware/hotMiddleware.js b/middleware/hotMiddleware.js index 149bc83..54ad47c 100644 --- a/middleware/hotMiddleware.js +++ b/middleware/hotMiddleware.js @@ -14,7 +14,7 @@ export default (compiler, opts) => { ctx.status = status ctx.set(headers) }, - res: noop + end: noop }, next) } }