我正在用前端的Angular7构建我的第一个CRUD,Spring / hib。当我尝试在我的component.ts中添加changeDetectionStrategy时,出现以下警告:
WARNING in ./node_modules/@angular/compiler/src/core.js
10:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
WARNING in ./node_modules/@angular/compiler/src/selector.js
10:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
WARNING in ./node_modules/@angular/compiler/src/ml_parser/html_tags.js
10:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
WARNING in ./node_modules/@angular/compiler/src/ml_parser/tags.js
10:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted.
该应用程序具有可以正常运行的其他组件,并且具有changeDetectionStrategy导入。当我将方法添加到我的组件中时,角度会给我这些错误。我注释了所有组件,除了@Component东西和“导出类XY {}”。错误一直存在,直到我删除changeDetectionStrategy。知道这是什么了吗?
答案 0 :(得分:1)
我认为这是由于changeDetectionStrategey的错误导入
import { ChangeDetectionStrategy } from '@angular/compiler/src/core';
将其替换为正确的
import { ChangeDetectionStrategy } from '@angular/core';