Unverified Commit fc8e0242 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

chore: rename typo middlewares to interceptors in hot reloader (#39292)

rename `middlewares` (typo, shouldn't have ending **s**) to `interceptors` to distinguish from middleware
parent a1895424
...@@ -156,7 +156,7 @@ function erroredPages(compilation: webpack5.Compilation) { ...@@ -156,7 +156,7 @@ function erroredPages(compilation: webpack5.Compilation) {
export default class HotReloader { export default class HotReloader {
private dir: string private dir: string
private buildId: string private buildId: string
private middlewares: any[] private interceptors: any[]
private pagesDir: string private pagesDir: string
private distDir: string private distDir: string
private webpackHotMiddleware?: WebpackHotMiddleware private webpackHotMiddleware?: WebpackHotMiddleware
...@@ -201,7 +201,7 @@ export default class HotReloader { ...@@ -201,7 +201,7 @@ export default class HotReloader {
) { ) {
this.buildId = buildId this.buildId = buildId
this.dir = dir this.dir = dir
this.middlewares = [] this.interceptors = []
this.pagesDir = pagesDir this.pagesDir = pagesDir
this.appDir = appDir this.appDir = appDir
this.distDir = distDir this.distDir = distDir
...@@ -284,7 +284,7 @@ export default class HotReloader { ...@@ -284,7 +284,7 @@ export default class HotReloader {
const { finished } = await handlePageBundleRequest(res, parsedUrl) const { finished } = await handlePageBundleRequest(res, parsedUrl)
for (const fn of this.middlewares) { for (const fn of this.interceptors) {
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
fn(req, res, (err: Error) => { fn(req, res, (err: Error) => {
if (err) return reject(err) if (err) return reject(err)
...@@ -933,7 +933,7 @@ export default class HotReloader { ...@@ -933,7 +933,7 @@ export default class HotReloader {
}), }),
}) })
this.middlewares = [ this.interceptors = [
getOverlayMiddleware({ getOverlayMiddleware({
rootDirectory: this.dir, rootDirectory: this.dir,
stats: () => this.clientStats, stats: () => this.clientStats,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment