mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 14:48:41 +00:00
refactor: normalize cache package dir (#15546)
This commit is contained in:
parent
b10d1628d5
commit
e030f4bfd1
@ -4,6 +4,7 @@ import { createRequire } from 'node:module'
|
||||
import {
|
||||
createFilter,
|
||||
isInNodeModules,
|
||||
normalizePath,
|
||||
safeRealpathSync,
|
||||
tryStatSync,
|
||||
} from './utils'
|
||||
@ -44,7 +45,7 @@ function invalidatePackageData(
|
||||
packageCache: PackageCache,
|
||||
pkgPath: string,
|
||||
): void {
|
||||
const pkgDir = path.dirname(pkgPath)
|
||||
const pkgDir = normalizePath(path.dirname(pkgPath))
|
||||
packageCache.forEach((pkg, cacheKey) => {
|
||||
if (pkg.dir === pkgDir) {
|
||||
packageCache.delete(cacheKey)
|
||||
@ -169,7 +170,7 @@ export function findNearestMainPackageData(
|
||||
|
||||
export function loadPackageData(pkgPath: string): PackageData {
|
||||
const data = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
|
||||
const pkgDir = path.dirname(pkgPath)
|
||||
const pkgDir = normalizePath(path.dirname(pkgPath))
|
||||
const { sideEffects } = data
|
||||
let hasSideEffects: (id: string) => boolean | null
|
||||
if (typeof sideEffects === 'boolean') {
|
||||
|
Loading…
Reference in New Issue
Block a user