javascript - 通过 npm / index.html 将 tex2max.js 导入 Angular 项目
问题描述
当我尝试使用导入时tex2max
,declare var tex2max: any;
我得到一个ReferenceError: tex2max is not defined
. 但这不会发生在其他 npm 包中。我尝试通过安装 npm 包并通过 index.html 中的脚本标记来绑定脚本,但无济于事。
这是源代码的CDN文件:
解决方案
如果项目作者稍微更正了他们的包,你可以这样做:
import TeX2Max from 'tex2max';
但这以错误告终[编辑:在 stackblitz 上]
Error in /turbo_modules/tex2max@1.3.0/lib/tex2max.js (13:28806)
Cannot assign to read only property 'exports' of object '[object Object]'
最好的选择是向作者提出问题。
推荐阅读
- google-apps-script - 无法运行绑定到新空白文档的琐碎应用脚本 - 获取“此应用已被阻止”
- javascript - 每当有人发布/推文时通知您的代码
- nlp - “带注释的变压器”中的 label_smoothing
- javascript - 组件异常元素类型无效
- azure-storage - Move-AzDataLakeGen2Item 失败,服务器无法对请求进行身份验证
- c++ - 优化 Vivado HLS 代码以减少图像处理算法的延迟
- xml - Cypress - Cucumber JUnit XML 报告
- settimeout - 在没有 setTimeout 或 setInterval 的情况下运行按延迟参数排序的多定时器 javascript
- javascript - typeof === 和 typeof == 的区别
- macros - ttl文件中的sendIn命令如何总是被识别为“未知命令”