Skip to content

Commit

Permalink
refactor(plugin-vue): use normalizePath from vite (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-leong authored May 30, 2024
1 parent 4627ff0 commit 2848174
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-vue/src/utils/descriptorCache.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fs from 'node:fs'
import path from 'node:path'
import { createHash } from 'node:crypto'
import slash from 'slash'
import type { CompilerError, SFCDescriptor } from 'vue/compiler-sfc'
import { normalizePath } from 'vite'
import type { ResolvedOptions, VueQuery } from '..'

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

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

0 comments on commit 2848174

Please sign in to comment.