mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): suppress warning about resolve cache-driver (#26595)
This commit is contained in:
parent
386be0b866
commit
2f8915127d
@ -12,6 +12,7 @@ import escapeRE from 'escape-string-regexp'
|
|||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import fsExtra from 'fs-extra'
|
import fsExtra from 'fs-extra'
|
||||||
import { dynamicEventHandler } from 'h3'
|
import { dynamicEventHandler } from 'h3'
|
||||||
|
import { isWindows } from 'std-env'
|
||||||
import type { Nuxt, NuxtOptions, RuntimeConfig } from 'nuxt/schema'
|
import type { Nuxt, NuxtOptions, RuntimeConfig } from 'nuxt/schema'
|
||||||
// @ts-expect-error TODO: add legacy type support for subpath imports
|
// @ts-expect-error TODO: add legacy type support for subpath imports
|
||||||
import { template as defaultSpaLoadingTemplate } from '@nuxt/ui-templates/templates/spa-loading-icon.mjs'
|
import { template as defaultSpaLoadingTemplate } from '@nuxt/ui-templates/templates/spa-loading-icon.mjs'
|
||||||
@ -416,10 +417,12 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const cacheDir = resolve(nuxt.options.buildDir, 'cache/nitro/prerender')
|
const cacheDir = resolve(nuxt.options.buildDir, 'cache/nitro/prerender')
|
||||||
|
const cacheDriverPath = await resolvePath(join(distDir, 'core/runtime/nitro/cache-driver'))
|
||||||
await fsp.rm(cacheDir, { recursive: true, force: true }).catch(() => {})
|
await fsp.rm(cacheDir, { recursive: true, force: true }).catch(() => {})
|
||||||
nitro.options._config.storage = defu(nitro.options._config.storage, {
|
nitro.options._config.storage = defu(nitro.options._config.storage, {
|
||||||
'internal:nuxt:prerender': {
|
'internal:nuxt:prerender': {
|
||||||
driver: pathToFileURL(await resolvePath(join(distDir, 'core/runtime/nitro/cache-driver'))).href,
|
// TODO: resolve upstream where file URLs are not being resolved/inlined correctly
|
||||||
|
driver: isWindows ? pathToFileURL(cacheDriverPath).href : cacheDriverPath,
|
||||||
base: cacheDir
|
base: cacheDir
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user