From 60b3965c02959eb0136e426cc9bef28f8126fa9e Mon Sep 17 00:00:00 2001 From: Edgar Lee Date: Tue, 26 Sep 2023 12:10:18 -0400 Subject: [PATCH] Fix normalize inconsistency between load & transform for filename - Some build systems symlink node_modules into the root, if normalized against config.root then the cache key between set & get will be different. --- packages/astro/src/vite-plugin-astro/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 1649d8069..83b9f7023 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -11,7 +11,6 @@ import { type CompileProps, } from '../core/compile/index.js'; import { isRelativePath } from '../core/path.js'; -import { normalizeFilename } from '../vite-plugin-utils/index.js'; import { cachedFullCompilation } from './compile.js'; import { handleHotUpdate } from './hmr.js'; import { parseAstroRequest } from './query.js'; @@ -45,7 +44,7 @@ export default function astro({ settings, logger }: AstroPluginOptions): vite.Pl return null; } // For CSS / hoisted scripts, the main Astro module should already be cached - const filename = normalizePath(normalizeFilename(parsedId.filename, config.root)); + const filename = normalizePath(parsedId.filename); const compileResult = getCachedCompileResult(config, filename); if (!compileResult) { return null;