Back to all fixes
CuratedTypeScriptVite 8local

resolve.tsconfigPaths aliases fail to resolve when importer is a virtual module (Vue SFC, TanStack Router split components)

Problem

With `resolve: { tsconfigPaths: true }`, path-aliased imports (e.g. `@/components/foo`) fail to resolve when the *importing* file is a virtual module id with a query string, such as a Vue SFC (`App.vue?id=0`) or a TanStack Router code-split component (`index.tsx?tsr-split=component`). Errors look like `Error: [vite]: Rolldown failed to resolve import "@/components/footer" from ".../_main.tsx?tsr-split=component"` during build, or on Windows specifically `Failed to run dependency scan... @/util/foo (imported by .../App.vue?id=0)` during dev.

Solution

typescript
Confirmed root cause and fix: the resolver (oxc-resolver) wasn't stripping/handling the query-string suffix on the importer's module id when resolving tsconfig paths. Fixed by oxc-project/oxc-resolver PR #1081 (linked and confirmed by Vite maintainer sapphi-red) - upgrading to a Vite/Rolldown release that bundles the patched oxc-resolver resolves it. Until you're on a fixed version, avoid the trigger by not aliasing imports from files that Vite gives a query-string module id (SFCs, split-route components) - use relative imports in those specific files as a stopgap.