在运行此示例时
https://github.com/kommen/clojurescript-webworker-demo
使用 ClojureScript 版本 1.10.738 或更新的版本时,我在网页控制台中收到此错误信息
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 一起工作,或者现在最好是继续使用较旧的版本?