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

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)