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

Using Node with babel cause #449

Open
sylvainpe opened this issue Nov 25, 2022 · 0 comments
Open

Using Node with babel cause #449

sylvainpe opened this issue Nov 25, 2022 · 0 comments

Comments

@sylvainpe
Copy link

sylvainpe commented Nov 25, 2022

Can't use threads.js in Node with babel

On runtime I have this error:

import { expose } from "threads/worker"
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at MessagePort.<anonymous> (internal/main/worker_thread.js:164:24)
    at MessagePort.emit (events.js:314:20)
    at MessagePort.onmessage (internal/worker/io.js:80:8)
    at MessagePort.exports.emitMessage (internal/per_context/messageport.js:11:10)
Emitted 'error' event on Worker instance at:
    at Worker.[kOnErrorMessage] (internal/worker.js:251:10)
    at Worker.[kOnMessage] (internal/worker.js:262:37)
    at MessagePort.<anonymous> (internal/worker.js:171:57)
    at MessagePort.emit (events.js:314:20)
    at MessagePort.EventEmitter.emit (domain.js:483:12)
    at MessagePort.onmessage (internal/worker/io.js:80:8)
    at MessagePort.exports.emitMessage (internal/per_context/messageport.js:11:10)
    at Worker.[kOnExit] (internal/worker.js:233:5)
    at Worker.<computed>.onexit (internal/worker.js:168:20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant