Skip to content

Ignore filename extension for child_process fork using when using Typescript #265

Description

@franciscohanna92

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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