Skip to content

Worker eval as ES Module #30682

Description

@targos

Unless I missed it, there doesn't seem to be a way of creating a Worker from an ESM source string (with eval: true).

Example that should be possible somehow:

import { Worker } from 'worker_threads';

new Worker(
  `
  import { join } from 'path';
  console.log(join('hello', 'world'));
`,
  { eval: true },
);

Related: #21502

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

    esmIssues and PRs related to the ECMAScript Modules implementation.workerIssues and PRs related to the worker_threads module and Worker API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions