Skip to content

Commit

Permalink
chore: 🐛 调整 dev server onBeforeMiddleware 调用顺序 (#10952)
Browse files Browse the repository at this point in the history
让 onBeforeMiddleware 真正优先于内置的 Middleware

Co-authored-by: pshu <pishu.spf@antfin.com>
  • Loading branch information
stormslowly and stormslowly committed Apr 12, 2023
1 parent 5596f55 commit 3b75d07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/bundler-webpack/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ export async function createServer(opts: IOpts): Promise<any> {
}
});

// before middlewares
(opts.beforeMiddlewares || []).forEach((m) => app.use(m));

// Provides the ability to execute custom middleware prior to all other middleware internally within the server.
if (opts.onBeforeMiddleware) {
opts.onBeforeMiddleware(app);
}

// before middlewares
(opts.beforeMiddlewares || []).forEach((m) => app.use(m));

// webpack dev middleware
const configs = Array.isArray(webpackConfig)
? webpackConfig
Expand Down

0 comments on commit 3b75d07

Please sign in to comment.