Using Node with babel cause
sylvainpe opened this issue · 0 comments
sylvainpe commented
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)