在 angular 5 中进行生产构建时,“mat-expansion-panel”不是已知元素

Shu*_*ham 4 production angular-material angular5

我在 Angular 5 项目中使用延迟加载,并且在其中一个模块中导入了“mat-expansion-panel”。'mat-expansion-panel' 在开发模式下工作正常,但是当我为生产进行构建时,它显示错误,即 'mat-expansion-panel' 不是已知元素而没有显示任何行号。

我到处搜索,但没有找到任何东西。

Val*_*cia 12

将此添加到您的 AppModule

import {MatExpansionModule} from '@angular/material/expansion';
Run Code Online (Sandbox Code Playgroud)

然后将“MatExpansionModule”添加到模块的导入中

  • 这对我不起作用,我已经在 AppModule 中正确导入了模块,并且该功能就像魅力一样,但是编译器在构建生产时失败 (4认同)