I keep getting these Warnings while deploying:
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
What I've tried:
https://github.com/angular/angular/issues/20357
My project structure:
My 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'
})
})
],
You were on the right direction, except the pluging name, try to add the following to your webpack.config.js after the existing ContextReplacementPlugin
new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)fesm5/, path.join(__dirname, './src')),
Same warning message when i update my angular app from 6 to 7.
I remove the message by adding the path "@angular/": ["../node_modules/@angular/"]
in compilerOptions in the tsconfig.json,
But I'm not sure this is the best solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With