Skip to content

javascript: resolve imports through a vite/webpack resolve.alias - #1781

Merged
swapnilpaliwal-sd merged 1 commit into
0.1.9from
loop/ja-is1746
Sep 29, 2026
Merged

swapnilpaliwal-sd merged 1 commit into
0.1.9from
loop/ja-is1746

Conversation

@swapnilpaliwal-sd

Copy link
Copy Markdown
Contributor

Imports through a resolve.alias declared only in vite.config.* / webpack.config.* (the usual Vite/Vue setup, no jsconfig) now resolve.

  • The config is read statically (never run); only replacements whose path the syntax fixes are taken: path.resolve/join(__dirname, …), fileURLToPath(new URL(…, import.meta.url)), root-relative strings. Object and [{find, replacement}] forms, webpack's exact key$.
  • The nearer of the bundler config and a tsconfig/jsconfig governs.
  • New golden case 71 with controls: a bare relative replacement, @utils/… vs @, a nearer jsconfig mapping @/* elsewhere, and Lib$ 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

…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
swapnilpaliwal-sd changed the base branch from 0.1.8 to 0.1.9 September 29, 2026 06:04
@swapnilpaliwal-sd
swapnilpaliwal-sd merged commit 224c622 into 0.1.9 Sep 29, 2026
12 checks passed
@swapnilpaliwal-sd
swapnilpaliwal-sd deleted the loop/ja-is1746 branch September 29, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant