Skip to content

Commit 8c2ac42

Browse files
authored
vite: Fix .css.ts file resolution on Windows (#1346)
1 parent ebd6988 commit 8c2ac42

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/eight-peas-provide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@vanilla-extract/vite-plugin': patch
3+
---
4+
5+
Fix `.css.ts` file resolution on Windows

packages/vite-plugin/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ export function vanillaExtractPlugin({
4747
if (
4848
filePath.startsWith(config.root) ||
4949
// In monorepos the absolute path will be outside of config.root, so we check that they have the same root on the file system
50+
// Paths from vite are always normalized, so we have to use the posix path separator
5051
(path.isAbsolute(filePath) &&
51-
filePath.split(path.sep)[1] === config.root.split(path.sep)[1])
52+
filePath.split(path.posix.sep)[1] ===
53+
config.root.split(path.posix.sep)[1])
5254
) {
5355
resolvedId = filePath;
5456
} else {

0 commit comments

Comments
 (0)