From 939cb80aea705f1ad464f0e56ed01f319df68b57 Mon Sep 17 00:00:00 2001 From: Adam Skoufis Date: Tue, 5 Mar 2024 21:12:05 +1100 Subject: [PATCH] Fix `.css.ts` file resolution on Windows --- .changeset/eight-peas-provide.md | 5 +++++ packages/vite-plugin/src/index.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/eight-peas-provide.md diff --git a/.changeset/eight-peas-provide.md b/.changeset/eight-peas-provide.md new file mode 100644 index 000000000..526bd416b --- /dev/null +++ b/.changeset/eight-peas-provide.md @@ -0,0 +1,5 @@ +--- +'@vanilla-extract/vite-plugin': patch +--- + +Fix `.css.ts` file resolution on Windows diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts index a67209f38..f690e0944 100644 --- a/packages/vite-plugin/src/index.ts +++ b/packages/vite-plugin/src/index.ts @@ -47,8 +47,10 @@ export function vanillaExtractPlugin({ if ( filePath.startsWith(config.root) || // In monorepos the absolute path will be outside of config.root, so we check that they have the same root on the file system + // Paths from vite are always normalized, so we have to use the posix path separator (path.isAbsolute(filePath) && - filePath.split(path.sep)[1] === config.root.split(path.sep)[1]) + filePath.split(path.posix.sep)[1] === + config.root.split(path.posix.sep)[1]) ) { resolvedId = filePath; } else {