mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
feat(webpack): add webpack:devMiddleware
and webpack:hotMiddleware
hooks (#3606)
This commit is contained in:
parent
a068e00451
commit
e891ea0cca
@ -143,6 +143,8 @@ export interface NuxtHooks {
|
||||
|
||||
// @nuxt/webpack
|
||||
'webpack:config': (webpackConfigs: Configuration[]) => HookResult
|
||||
'webpack:devMiddleware': (middleware: (req: IncomingMessage, res: ServerResponse, next: (err?: any) => any) => any) => HookResult
|
||||
'webpack:hotMiddleware': (middleware: (req: IncomingMessage, res: ServerResponse, next: (err?: any) => any) => any) => HookResult
|
||||
'build:compile': (options: { name: string, compiler: Compiler }) => HookResult
|
||||
'build:compiled': (options: { name: string, compiler: Compiler, stats: Stats }) => HookResult
|
||||
'build:resources': (mfs?: Compiler['outputFileSystem']) => HookResult
|
||||
|
@ -89,6 +89,9 @@ async function createDevMiddleware (compiler: Compiler) {
|
||||
...hotMiddlewareOptions
|
||||
}))
|
||||
|
||||
await nuxt.callHook('webpack:devMiddleware', devMiddleware)
|
||||
await nuxt.callHook('webpack:hotMiddleware', hotMiddleware)
|
||||
|
||||
// Register devMiddleware on server
|
||||
await nuxt.callHook('server:devMiddleware', async (req, res, next) => {
|
||||
for (const mw of [devMiddleware, hotMiddleware]) {
|
||||
|
Loading…
Reference in New Issue
Block a user