Skip to content

Commit

Permalink
Fix Vite critical CSS resolution when cwd differs from project root (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
frandiox committed Feb 15, 2024
1 parent 3573596 commit 291e729
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nice-jobs-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Vite: Fix issue resolving critical CSS during development when the current working directory differs from the project root
4 changes: 3 additions & 1 deletion packages/remix-dev/vite/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 291e729

Please sign in to comment.