Skip to content

Commit adc1d64

Browse files
authored
fix: normalize path(vitejs/vite#4556) (#290)
1 parent 57f6553 commit adc1d64

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed
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+
Normalize path of generated CSS files

packages/vite-plugin/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
},
2020
"devDependencies": {
2121
"vite": "^2.2.3"
22+
},
23+
"peerDependencies": {
24+
"vite": "^2.2.3"
2225
}
2326
}

packages/vite-plugin/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Plugin, ResolvedConfig } from 'vite';
2+
import { normalizePath } from 'vite';
23
import {
34
cssFileFilter,
45
virtualCssFileFilter,
@@ -24,7 +25,9 @@ export function vanillaExtractPlugin(): Plugin {
2425

2526
// resolveId shouldn't really cause a side-effect however custom module meta isn't currently working
2627
// This is a hack work around until https://github.com/vitejs/vite/issues/3240 is resolved
27-
const shortHashFileName = `${fileName}?hash=${hash(source)}`;
28+
const shortHashFileName = normalizePath(
29+
`${fileName}?hash=${hash(source)}`,
30+
);
2831
cssMap.set(shortHashFileName, source);
2932

3033
return shortHashFileName;

yarn.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,6 +3265,8 @@ __metadata:
32653265
dependencies:
32663266
"@vanilla-extract/integration": ^1.1.0
32673267
vite: ^2.2.3
3268+
peerDependencies:
3269+
vite: ^2.2.3
32683270
languageName: unknown
32693271
linkType: soft
32703272

0 commit comments

Comments
 (0)