Skip to content

Commit

Permalink
refactor(plugin-vue): use vite's normalizePath for path consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jh-leong committed Apr 23, 2024
1 parent 46d0baa commit 8cf4524
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 8cf4524

Please sign in to comment.