mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +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
|
// @nuxt/webpack
|
||||||
'webpack:config': (webpackConfigs: Configuration[]) => HookResult
|
'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:compile': (options: { name: string, compiler: Compiler }) => HookResult
|
||||||
'build:compiled': (options: { name: string, compiler: Compiler, stats: Stats }) => HookResult
|
'build:compiled': (options: { name: string, compiler: Compiler, stats: Stats }) => HookResult
|
||||||
'build:resources': (mfs?: Compiler['outputFileSystem']) => HookResult
|
'build:resources': (mfs?: Compiler['outputFileSystem']) => HookResult
|
||||||
|
@ -89,6 +89,9 @@ async function createDevMiddleware (compiler: Compiler) {
|
|||||||
...hotMiddlewareOptions
|
...hotMiddlewareOptions
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
await nuxt.callHook('webpack:devMiddleware', devMiddleware)
|
||||||
|
await nuxt.callHook('webpack:hotMiddleware', hotMiddleware)
|
||||||
|
|
||||||
// Register devMiddleware on server
|
// Register devMiddleware on server
|
||||||
await nuxt.callHook('server:devMiddleware', async (req, res, next) => {
|
await nuxt.callHook('server:devMiddleware', async (req, res, next) => {
|
||||||
for (const mw of [devMiddleware, hotMiddleware]) {
|
for (const mw of [devMiddleware, hotMiddleware]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user