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

Support for custom paths in tsconfig.json #493

Open
larsblumberg opened this issue Sep 1, 2024 · 1 comment
Open

Support for custom paths in tsconfig.json #493

larsblumberg opened this issue Sep 1, 2024 · 1 comment

Comments

@larsblumberg
Copy link

larsblumberg commented Sep 1, 2024

Problem

When configuring tsconfig.json with paths:

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": [
      "@fancyModules/*": ["./src/modules/fancyModule/*"]
    ]
  } 
}

the transpiler/loader used by threads wouldn't resolve these imports:

import { Thing } from "@fanceModules/things"

and thus lead to "module not found" errors.

Although this works perfectly when running the same code with ts-node / tsx.

Workaround

Do not use custom paths imports in any module that are directly or indirectly imported by a worker. Instead use relative imports for workers.

Related documentation

Possible support for threads?

Is there any change to get support for paths into threads?

@larsblumberg
Copy link
Author

At least for a production build this package helps rewriting the imports: https://github.com/benyap/resolve-tspaths

However that still doesn't resolve the issue for dev builds using ts-node / tsx.

@larsblumberg larsblumberg reopened this Sep 1, 2024
@larsblumberg larsblumberg changed the title Support for path in tsconfig.json Support for custom paths in tsconfig.json Sep 1, 2024
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