andywer / andywer/threads.js

Support for custom paths in tsconfig.json

オープン
#493 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
3.5k
フォーク
173
PR マージ指標
30日以内にマージされた PR はありません

説明

# 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

- https://www.typescriptlang.org/tsconfig/#paths
- https://www.typescriptlang.org/docs/handbook/modules/reference.html#paths

# Possible support for `threads`?

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。