镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

workerData export not available when using ES Modules #25765

Description

@GeorgeTaveras1231
  • Version: v11.8.0
  • Platform: Darwin NY-GTaverasMBA 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
  • Subsystem: worker_threads

The following code produces this error:

ERROR:

import { workerData } from 'worker_threads';
         ^^^^^^^^^^
SyntaxError: The requested module 'worker_threads' does not provide an export named 'workerData'

main.mjs:

import { Worker } from 'worker_threads';

const worker = new Worker('./worker.js', { workerData: 'Hello from main thread' });

worker.mjs:

import { workerData } from 'worker_threads';

console.log(workerData);

COMMAND:
node --experimental-modules main.mjs

Activity

  1. added
    esmIssues and PRs related to the ECMAScript Modules implementation.
    workerIssues and PRs related to the worker_threads module and Worker API.
    on Jan 28, 2019
  2. self-assigned this
    on Jan 28, 2019
  3. addaleax commented on Jan 28, 2019

    @addaleax
    Member

    #25768 should address this

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

Metadata

Metadata

Assignees

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