-
I am using ts-worker to run a node-worker .. it is a very lightweight wrapper that uses ts-node to compile before creating the worker. In using this, I am getting the error:
see: viniciusestevam/ts-worker#2
require('ts-node').register({ /* options */ }) and in the ts-worker library it is currently used like this: require('ts-node').register();
require(path.resolve(workerData.workerFilePath)); I would make a PR to handle this case, but I dont know how to get the tsconfig in there, or even if that is the right solution to my problem. edit: github version of this same issue, reproduced without relying on ts-worker: https://stackoverflow.com/questions/66430914/unable-to-access-path-shortcut-imports-in-worker |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Try with
Where if UUID declared? Is it a global type? Or do you need to Also, you should be able to use
|
Beta Was this translation helpful? Give feedback.
Try with
--files
. ts-node has an optimization to speed up typechecking where it only checks files referenced directly or indirectly by your entrypoint script. For example, if you runts-node ./index.ts
andindex.ts
importsfoo.ts
then it'll typecheck those 2 files. But if you have types from another file,bar.ts
, then those won't be pulled in.--files
disables this optimization and makests-node
match your tsconfig's files array.Where if UUID declared? Is it a global type? Or do you need to
import
it?Also, you should be able to use
ts-node
in worker threads like this: