Skip to content

Handle Typescript alias and package.json imports#35

Open
MacFJA wants to merge 2 commits intotapjs:mainfrom
MacFJA:fix/issue-11-12-path-mapping
Open

Handle Typescript alias and package.json imports#35
MacFJA wants to merge 2 commits intotapjs:mainfrom
MacFJA:fix/issue-11-12-path-mapping

Conversation

@MacFJA
Copy link

@MacFJA MacFJA commented Mar 7, 2025

Add path mapping for TypeScript and Node

This PR add a path mapping/alias resolution for TypeScript (tsconfig.json: compilerOptions.paths) and node (package.json: imports)

  • Add custom pre-resolver to transform requested path [src/hooks/hooks.mts + src/service/resolve-mapping.ts]
  • Fix issue where configuration from the loaded tsconfig.json are not correctly override (rootDir not defaulted to the directory that contains the tsconfig.json file, same for ts config parser) [src/service/tsconfig.ts]
  • Fix tsconfig.json option paths being removed [src/service/transpile-only.ts]

Reuse PR #24 as base for unit tests


Closes #11 and #12

path: options.configFilePath as string,
} as TsConfigResult

const pathMather = createPathsMatcher(tsconfigArg)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const pathMather = createPathsMatcher(tsconfigArg)
const pathMatcher = createPathsMatcher(tsconfigArg)

@drysius
Copy link

drysius commented Feb 7, 2026

nice

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.

Subpath imports not working

4 participants