./node_modules/@angular/core/fesm5/core.js 中的角度警告?

Muh*_*Ali 5 warnings angular

我在部署时不断收到这些警告:

WARNING in ./node_modules/@angular/core/fesm5/core.js
4996:15-36 Critical dependency: the request of a dependency is an expression
 @ ./node_modules/@angular/core/fesm5/core.js
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/main.ts

WARNING in ./node_modules/@angular/core/fesm5/core.js
5008:15-102 Critical dependency: the request of a dependency is an expression
 @ ./node_modules/@angular/core/fesm5/core.js
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/main.ts
Run Code Online (Sandbox Code Playgroud)

我试过的:

https://github.com/angular/angular/issues/20357

我的项目结构:

在此处输入图片说明

我的 webpack.config.js:

WARNING in ./node_modules/@angular/core/fesm5/core.js
4996:15-36 Critical dependency: the request of a dependency is an expression
 @ ./node_modules/@angular/core/fesm5/core.js
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/main.ts

WARNING in ./node_modules/@angular/core/fesm5/core.js
5008:15-102 Critical dependency: the request of a dependency is an expression
 @ ./node_modules/@angular/core/fesm5/core.js
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/main.ts
Run Code Online (Sandbox Code Playgroud)

小智 1

当我将 Angular 应用程序从 6 更新到 7 时,出现相同的警告消息。

我通过在 tsconfig.json 的 compilerOptions 中添加路径来删除该消息,"@angular/": ["../node_modules/@angular/"]

但我不确定这是最好的解决方案。