Skip to content

Commit 2848174

Browse files
authoredMay 30, 2024··
refactor(plugin-vue): use normalizePath from vite (#395)
1 parent 4627ff0 commit 2848174

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎packages/plugin-vue/src/utils/descriptorCache.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import fs from 'node:fs'
22
import path from 'node:path'
33
import { createHash } from 'node:crypto'
4-
import slash from 'slash'
54
import type { CompilerError, SFCDescriptor } from 'vue/compiler-sfc'
5+
import { normalizePath } from 'vite'
66
import type { ResolvedOptions, VueQuery } from '..'
77

88
// compiler-sfc should be exported so it can be re-used
@@ -33,7 +33,7 @@ export function createDescriptor(
3333

3434
// ensure the path is normalized in a way that is consistent inside
3535
// project (relative to root) and on different systems.
36-
const normalizedPath = slash(path.normalize(path.relative(root, filename)))
36+
const normalizedPath = normalizePath(path.relative(root, filename))
3737
descriptor.id = getHash(normalizedPath + (isProduction ? source : ''))
3838
;(hmr ? hmrCache : cache).set(filename, descriptor)
3939
return { descriptor, errors }

0 commit comments

Comments
 (0)
Please sign in to comment.