Skip to content

Commit

Permalink
fix isInComponents when mixing windows and non-windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Dec 20, 2024
1 parent 91b124a commit be99c48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/shared-internals/src/colocation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync } from 'fs-extra';
import { cleanUrl } from './paths';
import { cleanUrl, explicitRelative } from './paths';
import type PackageCache from './package-cache';
import { sep } from 'path';
import { resolve as resolveExports } from 'resolve.exports';
Expand Down Expand Up @@ -49,7 +49,7 @@ export function isInComponents(url: string, packageCache: Pick<PackageCache, 'ow
conditions: ['default', 'imports'],
});
let componentsDir = tryResolve?.[0] ?? './components';
return ('.' + id.slice(pkg?.root.length).split(sep).join('/')).startsWith(componentsDir);
return explicitRelative(pkg.root, id).split(sep).join('/').startsWith(componentsDir);
}

export function templateOnlyComponentSource() {
Expand Down

0 comments on commit be99c48

Please sign in to comment.