Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workerData export not available when using ES Modules #25765

Closed
GeorgeTaveras1231 opened this issue Jan 28, 2019 · 1 comment
Closed

workerData export not available when using ES Modules #25765

GeorgeTaveras1231 opened this issue Jan 28, 2019 · 1 comment
Assignees
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. worker Issues and PRs related to Worker support.

Comments

@GeorgeTaveras1231
Copy link

  • 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

@addaleax addaleax added esm Issues and PRs related to the ECMAScript Modules implementation. worker Issues and PRs related to Worker support. labels Jan 28, 2019
@addaleax addaleax self-assigned this Jan 28, 2019
addaleax added a commit to addaleax/node that referenced this issue Jan 28, 2019
@addaleax
Copy link
Member

#25768 should address this

targos pushed a commit that referenced this issue Jan 30, 2019
Fixes: #25765

PR-URL: #25768
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants