From da4709126b71218a8d9ae32f41f6187a820bdc67 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Tue, 15 Feb 2022 15:01:43 -0500 Subject: [PATCH] Does this work --- packages/astro/src/vite-plugin-astro/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 90f5519862cd1..0929040cc276c 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -53,14 +53,14 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu if(from) { const { query: fromQuery, filename } = parseAstroRequest(from); if(fromQuery.astro && isRelativePath(id)) { - const resolvedURL = new URL(id, pathToFileURL(filename)); - const resolved = fileURLToPath(resolvedURL); + const resolvedURL = new URL(id, `file://${filename}`); + const resolved = resolvedURL.pathname; - console.log("WINDOWS DEBUG2", isBrowserPath(slash(resolved)), filename, from,resolved, slash(resolved)) - if(isBrowserPath(slash(resolved))) { - return fileURLToPath(new URL('.' + slash(resolved), config.projectRoot)); + console.log("WINDOWS DEBUG2", resolved); + if(isBrowserPath(resolved)) { + return slash(fileURLToPath(new URL('.' + resolved, config.projectRoot))); } - return resolved; + return slash(fileURLToPath(resolvedURL)); } }