summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/crypto
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-06-02 13:56:29 +0200
committerFlorian Dold <florian@dold.me>2021-06-02 13:56:29 +0200
commit5e6cc41b7a8b41aec30a81b787e5e4b5ed60661a (patch)
tree45614dac0fa24a4c3de873226a1c2ffbb14c840f /packages/taler-wallet-core/src/crypto
parent02f1d4b08116c24f0af1f32cb6d82be292fa6d10 (diff)
downloadwallet-core-5e6cc41b7a8b41aec30a81b787e5e4b5ed60661a.tar.gz
wallet-core-5e6cc41b7a8b41aec30a81b787e5e4b5ed60661a.tar.bz2
wallet-core-5e6cc41b7a8b41aec30a81b787e5e4b5ed60661a.zip
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')
-rw-r--r--packages/taler-wallet-core/src/crypto/workers/nodeThreadWorker.ts8
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");