mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat(nitro): add nitro:build:before
hook (#4304)
* fix(nitro): add back `nitro:generate` hook * fix: use `nitro:generate` hook for vite workarounds * fix: remove comment * fix: only call `nitro:generate` in build mode * rename hook to `nitro:_build` * fix: use `nitro:build:before` * move dev guard Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
0a5da2bd5d
commit
1f8e3e2f33
@ -139,6 +139,7 @@ export async function initNitro (nuxt: Nuxt) {
|
||||
|
||||
// nuxt build/dev
|
||||
nuxt.hook('build:done', async () => {
|
||||
await nuxt.callHook('nitro:build:before', nitro)
|
||||
if (nuxt.options.dev) {
|
||||
await build(nitro)
|
||||
} else {
|
||||
|
@ -101,6 +101,7 @@ export interface NuxtHooks {
|
||||
// nitropack
|
||||
'nitro:config': (nitroConfig: NitroConfig) => HookResult
|
||||
'nitro:init': (nitro: Nitro) => HookResult
|
||||
'nitro:build:before': (nitro: Nitro) => HookResult
|
||||
|
||||
// @nuxt/cli
|
||||
'generate:cache:ignore': (ignore: string[]) => HookResult
|
||||
|
@ -88,8 +88,10 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
|
||||
await ctx.nuxt.callHook('vite:extendConfig', serverConfig, { isClient: false, isServer: true })
|
||||
|
||||
// TODO: Do we still need this?
|
||||
ctx.nuxt.hook('build:done', async () => {
|
||||
ctx.nuxt.hook('nitro:build:before', async () => {
|
||||
if (ctx.nuxt.options.dev) {
|
||||
return
|
||||
}
|
||||
const clientDist = resolve(ctx.nuxt.options.buildDir, 'dist/client')
|
||||
|
||||
// Remove public files that have been duplicated into buildAssetsDir
|
||||
|
Loading…
Reference in New Issue
Block a user