Repository navigation
javascript: resolve imports through a vite/webpack resolve.alias - #1781
Merged
Merged
Conversation
…lias A Vite or Vue app often declares '@' -> src only in vite.config.js, with no jsconfig.json, so every import through it stayed unresolved. The config is read (never run) for resolve.alias entries whose replacement the syntax fixes (path.resolve/join with __dirname, fileURLToPath(new URL(..., import.meta.url)), a root-relative string); the nearer of it and a tsconfig/jsconfig governs. Case 71 covers object and array alias forms, webpack's exact 'key$', and controls: a bare relative replacement, '@utils' vs '@', and a nearer jsconfig mapping '@/*' elsewhere. Co-authored-by: axiomcode-bot[bot] <334110751+axiomcode-bot[bot]@users.noreply.github.com>
swapnilpaliwal-sd
requested review from
JaredHLZhang,
Whua689 and
suyashpaliwal26
as code owners
September 29, 2026 06:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Imports through a
resolve.aliasdeclared only invite.config.*/webpack.config.*(the usual Vite/Vue setup, no jsconfig) now resolve.path.resolve/join(__dirname, …),fileURLToPath(new URL(…, import.meta.url)), root-relative strings. Object and[{find, replacement}]forms, webpack's exactkey$.@utils/…vs@, a nearer jsconfig mapping@/*elsewhere, andLib$exactness. None of them change.Checked: case 71 went from 1 to 5 known_edge. On a real Vue app, known_edge went from 56 to 91 and ambiguous_unknown from 287 to 247, with 0 edges lost and index time 2.28s → 2.39s. JS golden 85/85, javascript-tests 49/49, TS golden 94/94.
Closes #1746