fix: patch threads to work with production build

(cherry picked from commit 4da56bb0fe509c4cb0c4bb6e560b4383f185bf45)
This commit is contained in:
鲁树人
2021-12-15 14:02:43 +00:00
parent 0a52d2a20b
commit f80cf29657
3 changed files with 247 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
diff --git a/node_modules/threads/worker.mjs b/node_modules/threads/worker.mjs
index c53ac7d..619007b 100644
--- a/node_modules/threads/worker.mjs
+++ b/node_modules/threads/worker.mjs
@@ -1,4 +1,5 @@
-import WorkerContext from "./dist/worker/index.js"
+// Workaround: use of import seems to break minifier.
+const WorkerContext = require("./dist/worker/index.js")
export const expose = WorkerContext.expose
export const registerSerializer = WorkerContext.registerSerializer