【问题标题】:crypto-js trouble with index.html (Angular 2 project)index.html 的 crypto-js 问题(Angular 2 项目)
【发布时间】:2016-11-16 22:49:06
【问题描述】:

我使用以下命令将 crypto-js 放入我的 node_modules 文件夹

npm install crypto-js

然后,在我下载它之后,在我的 index.html 文件中,我使用以下命令,以便我可以调用 CryptoJS.SHA256() 方法。

<html>
  <head>
    <script src="node_modules/crypto-js/sha256"></script>
  </head>
</html>

(我省略了其他脚本调用、元和标题标签)

但是,当我使用“npm start”运行我的项目时,我收到以下错误

这到底是什么意思?我不确定如何解决“未找到”的问题,即使它应该在哪里。我可能错过了其他东西吗?

【问题讨论】:

    标签: html angular typescript sha256 cryptojs


    【解决方案1】:

    您使用未暴露于 Angular 的外部 javascript。只有 web dom 知道 crypto js 模块。看起来您只想使用 SHA256。我将只实现该函数的类型脚本版本并从那里开始。这是一个例子。

    https://github.com/dchest/fast-sha256-js

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-18
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 2017-12-27
      • 2017-09-03
      • 1970-01-01
      相关资源
      最近更新 更多