mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
feat(webpack): introduce webpack:configResolved
hook (#20412)
This commit is contained in:
parent
17ca50354b
commit
cd7f38988a
@ -75,6 +75,7 @@ Hook | Arguments | Description
|
||||
`vite:serverCreated` | `viteServer, env` | Called when the Vite server is created.
|
||||
`vite:compiled` | - | Called after Vite server is compiled.
|
||||
`webpack:config` | `webpackConfigs` | Called before configuring the webpack compiler.
|
||||
`webpack:configResolved` | `webpackConfigs` | Allows to read the resolved webpack config.
|
||||
`webpack:compile` | `options` | Called right before compilation.
|
||||
`webpack:compiled` | `options` | Called after resources are loaded.
|
||||
`webpack:change` | `shortPath` | Called on `change` on WebpackBar.
|
||||
|
@ -317,6 +317,12 @@ export interface NuxtHooks {
|
||||
* @returns Promise
|
||||
*/
|
||||
'webpack:config': (webpackConfigs: Configuration[]) => HookResult
|
||||
/**
|
||||
* Allows to read the resolved webpack config
|
||||
* @param webpackConfigs Configs objects to be pushed to the compiler
|
||||
* @returns Promise
|
||||
*/
|
||||
'webpack:configResolved': (webpackConfigs: Readonly<Configuration>[]) => HookResult
|
||||
/**
|
||||
* Called right before compilation.
|
||||
* @param options The options to be added
|
||||
|
@ -35,8 +35,7 @@ export async function bundle (nuxt: Nuxt) {
|
||||
// Initialize shared MFS for dev
|
||||
const mfs = nuxt.options.dev ? createMFS() : null
|
||||
|
||||
// Configure compilers
|
||||
const compilers = webpackConfigs.map((config) => {
|
||||
for (const config of webpackConfigs) {
|
||||
config.plugins!.push(DynamicBasePlugin.webpack({
|
||||
sourcemap: nuxt.options.sourcemap[config.name as 'client' | 'server']
|
||||
}))
|
||||
@ -49,7 +48,12 @@ export async function bundle (nuxt: Nuxt) {
|
||||
rootDir: nuxt.options.rootDir,
|
||||
composables: nuxt.options.optimization.keyedComposables
|
||||
}))
|
||||
}
|
||||
|
||||
await nuxt.callHook('webpack:configResolved', webpackConfigs)
|
||||
|
||||
// Configure compilers
|
||||
const compilers = webpackConfigs.map((config) => {
|
||||
// Create compiler
|
||||
const compiler = webpack(config)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user