mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +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>{
|
const nitroConfig: NitroConfig = defu(_nitroConfig, <NitroConfig>{
|
||||||
|
static: nuxt.options._generate,
|
||||||
debug: nuxt.options.debug,
|
debug: nuxt.options.debug,
|
||||||
rootDir: nuxt.options.rootDir,
|
rootDir: nuxt.options.rootDir,
|
||||||
workspaceDir: nuxt.options.workspaceDir,
|
workspaceDir: nuxt.options.workspaceDir,
|
||||||
@ -347,11 +348,12 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
await copyPublicAssets(nitro)
|
await copyPublicAssets(nitro)
|
||||||
await nuxt.callHook('nitro:build:public-assets', nitro)
|
await nuxt.callHook('nitro:build:public-assets', nitro)
|
||||||
await prerender(nitro)
|
await prerender(nitro)
|
||||||
if (!nuxt.options._generate) {
|
|
||||||
logger.restoreAll()
|
logger.restoreAll()
|
||||||
await build(nitro)
|
await build(nitro)
|
||||||
logger.wrapAll()
|
logger.wrapAll()
|
||||||
} else {
|
|
||||||
|
if (nuxt.options._generate) {
|
||||||
const distDir = resolve(nuxt.options.rootDir, 'dist')
|
const distDir = resolve(nuxt.options.rootDir, 'dist')
|
||||||
if (!existsSync(distDir)) {
|
if (!existsSync(distDir)) {
|
||||||
await fsp.symlink(nitro.options.output.publicDir, distDir, 'junction').catch(() => {})
|
await fsp.symlink(nitro.options.output.publicDir, distDir, 'junction').catch(() => {})
|
||||||
|
Loading…
Reference in New Issue
Block a user