Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Problem with forking child process #299

Description

@cb-myroslava

Issue description

Initially I had a following setup for forking a child process (neighbour '.ts' file) using ts-node:

import {fork} from 'child_process'
...
const workerPath = path.join(__dirname, '..', 'workers', 'calculate')
const process = fork(workerPath)
process.on('message', response => {
  console.log('response', response)
})

process.send({hello: 'world'})

The worker file has ts extension in development and js in production.
The worker file has been returning also a response to the main process (it is a single number).

However, after switching to ts-node-dev, I started to receive another response back from the child process:

{
"compile": "/Users/username/work/project/admin/api/src/workers/calculate.ts",
"compiledPath": "/var/folders/4d/t2sjr3s93j3bvm8c6vjm26sm0000gp/T/.…280e6bb65d555c3a57ce68c5110f7a14a9dbfad584ac45.js
}

and the actual worker file is not executed.
Is anything that I'm doing wrong?
I'm launching my application with the following command:

PORT=4000 ts-node-dev -r tsconfig-paths/register --watch api --project  ./api/tsconfig.json ./api/src

Context

OS version (is it docker or host?), ts-node-dev version

MacOS BigSur 11.6
ts-node-dev: 1.1.8

Did you try to run with ts-node?

Yes, it works correctly with ts-node.

Did you try to run with --files option enabled?

Yes, nothing changed.

Did you try to run with --debug option enabled?

Yes, nothing changed.

Do you have a repro example (git repo) with simple steps to reproduce your problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions