A relative import in a script block does not resolve, while a tsconfig path alias to the same file does. The specifier is correct and the target exists.
Repro
stxrepro/target.ts
stxrepro/deep/rel.stxtarget.ts:
export const THING = 'value'deep/rel.stx:
<script server>
import { THING } from '../target'
const label = THING
</script>
<template><p>{{ label }}</p></template>$ stx typecheck "stxrepro/deep/rel.stx"
rel.stx:2:23 error TS2307 Cannot find module '../target' or its corresponding type declarations. [<script server>]The alias form works
Same file, same target, reached through paths:
<script server>
import { FEATURES } from '~/app/Support/Marketing/catalog'
</script> Checked 1 script block(s) and 1 template expression(s) in 1 file(s) — 0 error(s), 0 warning(s)So readProjectPathAliases is doing its job and module resolution is otherwise healthy. It is specifically the relative specifier that fails — consistent with the virtual program resolving it against the temp directory the generated tsconfig lives in, rather than against the real directory of the .stx file.
Where it shows up
Two marketing components import a shared catalog the ordinary way:
import { FEATURES, USE_CASES } from '../../../app/Support/Marketing/catalog'The path is correct, the file is 13 KB of real exports, and the page renders it fine. It is only the checker that cannot follow it — the last 2 errors in a corpus otherwise down from 432 to 45, and the only ones with no app-side fix that is not a workaround.
Why it matters beyond two files
A relative import is the first thing anyone writes, and it is what every editor's auto-import produces. An app that hits this either rewrites correct imports to aliases to appease the checker, or mutes the checker. Both are worse than the import.
Suggested fix
Resolve module specifiers against the original file's directory. If the virtual file keeps living in a temp directory, paths alone will not cover the relative case — mapping the virtual file back to its real path for resolution, or adding a rootDirs/baseUrl entry pointing at the source directory, would.
Worth a test alongside the paths one that already exists, since the two travel together and only one is covered.