diff options
author | Florian Dold <florian@dold.me> | 2021-06-02 13:56:29 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-02 13:56:29 +0200 |
commit | 5e6cc41b7a8b41aec30a81b787e5e4b5ed60661a (patch) | |
tree | 45614dac0fa24a4c3de873226a1c2ffbb14c840f /packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts | |
parent | 02f1d4b08116c24f0af1f32cb6d82be292fa6d10 (diff) | |
download | wallet-core-5e6cc41b7a8b41aec30a81b787e5e4b5ed60661a.tar.xz |
fix issues with circular imports
Parts of this commit are from a patch by sebasjm. The circular imports
caused an issue with webpack. While we don't use webpack in the wallet,
the wallet should still be importable by webpack.
Some packages were importing their dependencies via "index.js", which
re-exports public exports of the package. This resulted in circular
dependencies which were resolved correctly by rollup, but not by
webpack.
Diffstat (limited to 'packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts')
-rw-r--r-- | packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts index 84d83312f..66fd2de76 100644 --- a/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts +++ b/packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts @@ -92,7 +92,10 @@ export function handleWorkerMessage(msg: any): void { try { const result = (impl as any)[operation](...args); // eslint-disable-next-line @typescript-eslint/no-var-requires - const worker_threads = require("worker_threads"); + const _r = "require" + const worker_threads: typeof import("worker_threads") = module[_r]("worker_threads"); + // const worker_threads = require("worker_threads"); + const p = worker_threads.parentPort; worker_threads.parentPort?.postMessage; if (p) { @@ -146,7 +149,8 @@ class NodeThreadCryptoWorker implements CryptoWorker { constructor() { // eslint-disable-next-line @typescript-eslint/no-var-requires - const worker_threads = require("worker_threads"); + const _r = "require" + const worker_threads = module[_r]("worker_threads"); logger.trace("starting node crypto worker"); |