Skip to content

Commit c3e83bb

Browse files
authored
fix: scan entries when the root is in node_modules (#15746)
1 parent 78d838a commit c3e83bb

File tree

1 file changed

+4
-3
lines changed
  • packages/vite/src/node/optimizer

1 file changed

+4
-3
lines changed

packages/vite/src/node/optimizer/scan.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,16 @@ function orderedDependencies(deps: Record<string, string>) {
239239
}
240240

241241
function globEntries(pattern: string | string[], config: ResolvedConfig) {
242+
const rootPattern = glob.convertPathToPattern(config.root)
242243
return glob(pattern, {
243244
cwd: config.root,
244245
ignore: [
245-
'**/node_modules/**',
246-
`**/${config.build.outDir}/**`,
246+
`${rootPattern}/**/node_modules/**`,
247+
`${rootPattern}/**/${config.build.outDir}/**`,
247248
// if there aren't explicit entries, also ignore other common folders
248249
...(config.optimizeDeps.entries
249250
? []
250-
: [`**/__tests__/**`, `**/coverage/**`]),
251+
: [`${rootPattern}/**/__tests__/**`, `${rootPattern}/**/coverage/**`]),
251252
],
252253
absolute: true,
253254
suppressErrors: true, // suppress EACCES errors

0 commit comments

Comments
 (0)