From cf0956437c6b452c88b84978239709e7dfdcf9d2 Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Thu, 15 Feb 2024 20:40:56 +0900 Subject: [PATCH] Fix Vite critical CSS resolution when cwd differs from project root (#8752) --- packages/remix-dev/vite/styles.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/remix-dev/vite/styles.ts b/packages/remix-dev/vite/styles.ts index f8691f051..9996afa1b 100644 --- a/packages/remix-dev/vite/styles.ts +++ b/packages/remix-dev/vite/styles.ts @@ -37,7 +37,9 @@ const getStylesForFiles = async ({ try { for (let file of files) { - let normalizedPath = path.resolve(file).replace(/\\/g, "/"); + let normalizedPath = path + .resolve(rootDirectory, file) + .replace(/\\/g, "/"); let node = await viteDevServer.moduleGraph.getModuleById(normalizedPath); // If the module is only present in the client module graph, the module