Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue loading absolute paths when not using baseUrl #275

Open
taeemo opened this issue Jan 4, 2025 · 0 comments
Open

Issue loading absolute paths when not using baseUrl #275

taeemo opened this issue Jan 4, 2025 · 0 comments

Comments

@taeemo
Copy link

taeemo commented Jan 4, 2025

There's an issue with properly loading absolute paths.

Basically, we have a root tsconfig base:

{
  "compilerOptions": {
    ...
    "paths": {
      "entities/*": ["./app/entities/*"],
    }
  },
  "ts-node": {
    "require": ["tsconfig-paths/register"]
  }
}

Then we have another part of the app that tries to use that configuration but instead of fails:

C:\src\sample-paths\app\function> npm run start

> [email protected] start
> ts-node index.ts

Error: Cannot find module 'entities/SimpleClass'
Require stack:
- C:\src\sample-paths\app\function\index.ts

This works if I either set baseUrl: "." in the root tsconfig, or duplicate the paths inside the inner tsconfig.json

I've created a very simple reproducible repository here https://github.com/taeemo/ts-paths-issue

I've checked a bunch of tickets from this repo, this one seems similar #190 but not super sure.

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

No branches or pull requests

1 participant