mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
fix(nuxt): use static nitro build if possible (#21655)
This commit is contained in:
parent
be3f6f7018
commit
14a7d95139
@ -39,6 +39,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||
}
|
||||
|
||||
const nitroConfig: NitroConfig = defu(_nitroConfig, <NitroConfig>{
|
||||
static: nuxt.options._generate,
|
||||
debug: nuxt.options.debug,
|
||||
rootDir: nuxt.options.rootDir,
|
||||
workspaceDir: nuxt.options.workspaceDir,
|
||||
@ -347,11 +348,12 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||
await copyPublicAssets(nitro)
|
||||
await nuxt.callHook('nitro:build:public-assets', nitro)
|
||||
await prerender(nitro)
|
||||
if (!nuxt.options._generate) {
|
||||
|
||||
logger.restoreAll()
|
||||
await build(nitro)
|
||||
logger.wrapAll()
|
||||
} else {
|
||||
|
||||
if (nuxt.options._generate) {
|
||||
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