当运行此示例时
https://github.com/kommen/clojurescript-webworker-demo
使用 1.10.738 或更新的 ClojureScript 版本,我在 Web 控制台收到此错误消息
ReferenceError: document is not defined dom.js:2499:3
DomHelper https://127.0.0.1:7777/out/goog/dom/dom.js:2499
getDomHelper https://127.0.0.1:7777/out/goog/dom/dom.js:87
CrossPageChannel https://127.0.0.1:7777/out/goog/net/xpc/crosspagechannel.js:94
cljs$core$IFn$_invoke$arity$1 https://127.0.0.1:7777/out/clojure/browser/net.js:575
clojure$browser$net$xpc_connection https://127.0.0.1:7777/out/clojure/browser/net.js:555
clojure$browser$repl$connect https://127.0.0.1:7777/out/clojure/browser/repl.js:347
<anonymous> https://127.0.0.1:7777/out/clojure/browser/repl/preload.js:7
CLOSURE_IMPORT_SCRIPT https://127.0.0.1:7777/mywebworker.js:3
load https://127.0.0.1:7777/out/goog/base.js:3406
loadDeps_ https://127.0.0.1:7777/out/goog/base.js:3043
loadDeps_ https://127.0.0.1:7777/out/goog/base.js:3047
load_ https://127.0.0.1:7777/out/goog/base.js:2942
require https://127.0.0.1:7777/out/goog/base.js:905
<anonymous> https://127.0.0.1:7777/mywebworker.js:7
在 1.10.597 版本中,信息 "hello from the web worker!" 仍然正确打印。
有没有简单的方法可以让新版本与 webworkers 一起工作,或者现在还是继续使用旧版本更好?