Skip to content

Commit

Permalink
chore: ignore foo?bar#baz
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Mar 26, 2023
1 parent 115b1a3 commit 863bd81
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,18 @@ function tryFsResolve(
const hashIndex = fsPath.indexOf('#')
if (hashIndex > 0 && isInNodeModules(fsPath)) {
const queryIndex = fsPath.indexOf('?')
const file = queryIndex > hashIndex ? fsPath.slice(0, queryIndex) : fsPath
const res = tryCleanFsResolve(
file,
options,
tryIndex,
targetWeb,
skipPackageJson,
)
if (res) return res + fsPath.slice(file.length)
// We only need to check foo#bar?baz and foo#bar, ignore foo?bar#baz
if (queryIndex < 0 || queryIndex > hashIndex) {
const file = queryIndex > hashIndex ? fsPath.slice(0, queryIndex) : fsPath
const res = tryCleanFsResolve(
file,
options,
tryIndex,
targetWeb,
skipPackageJson,
)
if (res) return res + fsPath.slice(file.length)
}
}

const { file, postfix } = splitFileAndPostfix(fsPath)
Expand Down

0 comments on commit 863bd81

Please sign in to comment.