当我尝试在 clojurescript 项目中要求 Sha256 时:
(ns tutorial-client.sha256
(:require
[goog.crypt.Sha256 :as hasher]))
我没有收到任何实际的编译错误,但是当我在浏览器中打开 clojurescript->js 输出时,我确实收到了以下内容。
Uncaught Error: Undefined nameToPath for goog.crypt.Sha256 base.js:586
Uncaught ReferenceError: cljs is not defined rendering.js:7
goog.require could not find: goog.crypt.Sha256 base.js:333
Uncaught Error: goog.require could not find: goog.crypt.Sha256 base.js:337
Uncaught ReferenceError: cljs is not defined behavior.js:8
Uncaught ReferenceError: cljs is not defined app.js:100
Uncaught TypeError: Cannot read property 'IE' of undefined eventtype.js:60
Uncaught TypeError: Cannot read property 'entryPointRegistry' of undefined events.js:1084
Uncaught TypeError: Cannot read property 'IE' of undefined browserfeature.js:35
Uncaught TypeError: Cannot read property 'Error' of undefined asserts.js:71
Uncaught TypeError: Cannot read property 'prototype' of undefined base.js:1407
Uncaught Error: Invalid event type events.js:139
Uncaught Error: Invalid event type events.js:139
Uncaught TypeError: Cannot call method 'call' of undefined
我认为其中大部分可能都可以忽略,问题是它基本上找不到 goog.crypt.Sha256 的首要错误。有趣的是,如果我将代码更改为以下内容,我可以消除所有错误。
(ns tutorial-client.sha256
(:require
[goog.net.XhrIo :as hasher]))
无论如何,我只想访问 goog.crypt.sha256 。谢谢你。