andywer / andywer/threads.js

Support for custom paths in tsconfig.json

Abierto
#493 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
3.5k
Forks
173
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

# 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`?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.