angular10 - Angular 10 typescript 3.9 npm 运行测试在导入时失败
问题描述
我正在使用 Angular v10.0.3 和 typescript v 3.9.7。当我跑步时,npm run test:ci
我得到以下信息。我import moment from 'moment'
在我的组件和服务中使用。还在我的 tsconfig.app.json 中启用了“allowSyntheticDefaultImports”标志
"compilerOptions": {
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
}
任何人都可以帮助解决此错误吗?
export = moment;
~~~~~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
client/app/shared/services/util.service.ts:3:8 - error TS1259: Module '"E:/Dev/TPS-Web/Src/OPUS/node_modules/moment/ts3.1-typings/moment"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
谢谢
解决方案
推荐阅读
- html - 如何创建具有 4 个扇区的圆形 SVG?
- python - 如何根据 Pandas 中的条件获取姓氏
- python - 在大型数据集中加速 groupby 和聚合
- python - 以 1 Min 频率 Python 在时间序列中删除具有 Nan 值的任何一天
- jenkins - 管理两个不同但相关的詹金斯作业的构建
- angular - 发生未处理的异常:开发服务器仅支持每次构建本地化单个语言环境
- android - 安卓模拟器图标不见了
- c++ - LeetCode 问题:在没有哈希的情况下提高执行时间?
- javascript - Discord.js 角色反应
- aws-appsync - AppSync 解析器:不允许在 JSON 字符串末尾使用尾随字符