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