Skip to content

Commit ab0c22d

Browse files
authored
fix: cache importers invalidation on Windows (#255)
1 parent dfdc815 commit ab0c22d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/vite-plugin/src/stylesPlugin.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { utimes } from 'fs/promises'
22
import * as path from 'upath'
33
import _debug from 'debug'
4+
import { normalizePath } from 'vite'
45
import { cacheDir, writeStyles, resolveVuetifyBase } from '@vuetify/loader-shared'
56

67
import type { Plugin, ViteDevServer } from 'vite'
@@ -98,11 +99,13 @@ export function stylesPlugin (options: Options): Plugin {
9899
await writeStyles(files)
99100

100101
if (server && needsTouch) {
101-
server.moduleGraph.getModulesByFile(cacheDir('styles.scss'))?.forEach(module => {
102+
const cacheFile = normalizePath(cacheDir('styles.scss'))
103+
server.moduleGraph.getModulesByFile(cacheFile)?.forEach(module => {
102104
module.importers.forEach(module => {
103105
if (module.file) {
106+
const now = new Date()
104107
debug(`touching ${module.file}`)
105-
utimes(module.file, Date.now(), Date.now())
108+
utimes(module.file, now, now)
106109
}
107110
})
108111
})

0 commit comments

Comments
 (0)