mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): skip server build with generate (#4472)
This commit is contained in:
parent
be804742f5
commit
3c3291226d
@ -1,4 +1,4 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import { existsSync, promises as fsp } from 'node:fs'
|
||||
import { resolve, join } from 'pathe'
|
||||
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender } from 'nitropack'
|
||||
import type { NitroEventHandler, NitroDevEventHandler, NitroConfig } from 'nitropack'
|
||||
@ -144,7 +144,14 @@ export async function initNitro (nuxt: Nuxt) {
|
||||
await prepare(nitro)
|
||||
await copyPublicAssets(nitro)
|
||||
await prerender(nitro)
|
||||
if (!nuxt.options._generate) {
|
||||
await build(nitro)
|
||||
} else {
|
||||
const distDir = resolve(nuxt.options.rootDir, 'dist')
|
||||
if (!existsSync(distDir)) {
|
||||
await fsp.symlink(nitro.options.output.publicDir, distDir, 'junction').catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user