The workshop’s spec plate: tsconfig paths and baseUrl, tsc’s trace looking for the file step by step, TypeScript 6’s and 7’s errors, then Vite’s dev server…
"The editor and tsc are green, but the build or the tests scream Cannot find module" is the most common alias complaint. Its root: paths is for tsc only. Knowing how tsc matches a pattern and looks for files, plus how to tell the bundler, stops the guessing.
paths is a map for tsc alone: a pattern, then file after file
tsc and the editor are green, but vitest or the dev server screams Failed to resolve import paths belongs to tsc. Vite 8’s vite build happens to read it by itself, the dev server and Vitest do not. Tell every resolver: resolve.tsconfigPaths: true (Vite 8, which Vitest uses too), or the same resolve.alias, moduleNameMapper in Jest; or rewrite the imports at build time with tsc-alias.baseUrl: where are paths targets read from? Since TypeScript 4.1 you do not need baseUrl: without it, targets are read from tsconfig’s folder. It is baseUrl that shifts where they start ("src/*" with baseUrl: "./src" becomes src/src/…), deprecated in TypeScript 6 (TS5101) and removed in 7 (TS5102). Write targets with ././* in the key or the target "@/*": ["./src/*"] needs a star on both sides: what the star captures is slotted into the target. "@": ["./src"] matches only @ exactly, not @/utils. (Vite’s alias @ does match as a prefix; that is why the two tools can disagree.)@/* and ./src/*.resolve.tsconfigPaths: true with working paths.