首页 > 解决方案 > 无法读取未定义的属性(读取 emod)

问题描述

我在 github 存储库中有一个带有自定义组件的 Ang12 项目,我正在尝试在另一个项目中使用它,但在运行时出现以下错误:无法读取未定义的属性(读取 emod)。npm i git@github:.../house-building.git 和 ng build,serve 工作正常,但是当我在当前项目中使用来自 git 的组件时出现此错误:my-current-project.html:

<house-building></house-building> 

有没有人试图这样做并有这个错误?

标签: angulartypescriptgithubnode-modulesangular-components

解决方案


我遇到了同样的问题。目前,我必须使用生产配置来解决这个问题。如果您有完美的解决方案,请告诉我。

这是我的解决方案:

angular.json设置optimizationtrue


            "development": {
              "buildOptimizer": false,
              "optimization": true, // resolve the problem of (reading emod)
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }


推荐阅读