node-dev icon indicating copy to clipboard operation
node-dev copied to clipboard

Ignore filename extension for child_process fork using when using Typescript

Open franciscohanna92 opened this issue 4 years ago • 0 comments

I'm using child_process's fork method to instantiate a subprocess, like so:

fork(path.join(__dirname, './worker.ts'));

The problem is that when building (transpiling) my project, a MODULE_NOT_FOUND is thrown because worker.ts turned into worker.js. Initially, mi idea was to omit the file extension, but if I do so, when running the project with node-dev, it throws a MODULE_NOT_FOUND because it can't resolve the file if the extension is not present.

What's the workaround for this?

I'm on Windows 10 using node v12.22.1

franciscohanna92 avatar Aug 27 '21 14:08 franciscohanna92