From 2f8915127df96648e1137217de954b59c579fd42 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 3 Apr 2024 09:51:05 +0100 Subject: [PATCH] fix(nuxt): suppress warning about resolve cache-driver (#26595) --- packages/nuxt/src/core/nitro.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/core/nitro.ts b/packages/nuxt/src/core/nitro.ts index 128e08b198..5f35fc145f 100644 --- a/packages/nuxt/src/core/nitro.ts +++ b/packages/nuxt/src/core/nitro.ts @@ -12,6 +12,7 @@ import escapeRE from 'escape-string-regexp' import { defu } from 'defu' import fsExtra from 'fs-extra' import { dynamicEventHandler } from 'h3' +import { isWindows } from 'std-env' import type { Nuxt, NuxtOptions, RuntimeConfig } from 'nuxt/schema' // @ts-expect-error TODO: add legacy type support for subpath imports 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 cacheDriverPath = await resolvePath(join(distDir, 'core/runtime/nitro/cache-driver')) await fsp.rm(cacheDir, { recursive: true, force: true }).catch(() => {}) nitro.options._config.storage = defu(nitro.options._config.storage, { '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 } })