Skip to content

fix: resolve tsconfig path aliases containing a colon#780

Open
msmx-mnakagawa wants to merge 1 commit intoprivatenumber:masterfrom
msmx-mnakagawa:fix/tsconfig-paths-with-colon
Open

fix: resolve tsconfig path aliases containing a colon#780
msmx-mnakagawa wants to merge 1 commit intoprivatenumber:masterfrom
msmx-mnakagawa:fix/tsconfig-paths-with-colon

Conversation

@msmx-mnakagawa
Copy link
Contributor

@msmx-mnakagawa msmx-mnakagawa commented Feb 24, 2026

Fixes #730

Root cause

resolveTsPaths (ESM hook) gates tsconfigPathsMatcher behind !requestAcceptsQuery(specifier).
requestAcceptsQuery returns true for any specifier containing : — treating it as a URL scheme — so aliases like ns:something bypass path resolution and are passed raw to Node's ESM loader, which rejects the unknown scheme.

The CJS equivalent uses !isFilePath(request) and is unaffected.

Fix

Replace !requestAcceptsQuery(specifier) with !isFilePath(specifier) && !specifier.startsWith(fileUrlPrefix), mirroring the CJS check.
The fileUrlPrefix guard is ESM-specific: file:// specifiers may arrive in the ESM hook directly, whereas CJS pre-converts them to file paths before this point.

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.

ERR_UNSUPPORTED_ESM_URL_SCHEME error is thrown if path alias contains a colon

1 participant