Угловое ПРЕДУПРЕЖДЕНИЕ в ./node_modules/@angular/core/fesm5/core.js? - PullRequest
0 голосов
/ 03 октября 2018

Я получаю эти предупреждения при развертывании:

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

Что я пробовал:

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

Структура моего проекта:

enter image description here

Мой webpack.config.js:

var path = require('path');
plugins: [
  new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)esm5/, path.join(__dirname, './src')),
  new HtmlWebpackPlugin({
    template: './src/index.html',
    filename: 'index.html',
    inject: 'body'
  }),
  new webpack.DefinePlugin({
    // global app config object
    config: JSON.stringify({
      apiUrl: 'http://localhost:4000'
    })
  })
],

Ответы [ 2 ]

0 голосов
/ 12 декабря 2018

Вы были в правильном направлении, кроме имени подключения, попробуйте добавить следующее в ваш webpack.config.js после существующего ContextReplacementPlugin

new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)fesm5/, path.join(__dirname, './src')),
0 голосов
/ 26 ноября 2018

То же предупреждение, когда я обновляю свое угловое приложение с 6 до 7.

Я удаляю сообщение, добавляя путь "@angular/<em>": ["../node_modules/@angular/</em>"] в compilerOptions в tsconfig.json,

Но яя не уверен, что это лучшее решение.

...