Skip to content

Commit

Permalink
fix: scan entries when the root is in node_modules (#15746)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinjiang authored Feb 6, 2024
1 parent 78d838a commit c3e83bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,16 @@ function orderedDependencies(deps: Record<string, string>) {
}

function globEntries(pattern: string | string[], config: ResolvedConfig) {
const rootPattern = glob.convertPathToPattern(config.root)
return glob(pattern, {
cwd: config.root,
ignore: [
'**/node_modules/**',
`**/${config.build.outDir}/**`,
`${rootPattern}/**/node_modules/**`,
`${rootPattern}/**/${config.build.outDir}/**`,
// if there aren't explicit entries, also ignore other common folders
...(config.optimizeDeps.entries
? []
: [`**/__tests__/**`, `**/coverage/**`]),
: [`${rootPattern}/**/__tests__/**`, `${rootPattern}/**/coverage/**`]),
],
absolute: true,
suppressErrors: true, // suppress EACCES errors
Expand Down

0 comments on commit c3e83bb

Please sign in to comment.