[英]Debugging Angular 6 Universal with SSR
Angular 6 is working with Universal SSR, but it's eating up my server resources. Angular 6正在使用Universal SSR,但它正在消耗我的服务器资源。 I have the following warnings when PROD gets built.
生成PROD时,我有以下警告。
WARNING in ./node_modules/bindings/bindings.js
81:22-40 Critical dependency: the request of a dependency is an expression
@ ./node_modules/bindings/bindings.js
@ ./node_modules/utf-8-validate/index.js
@ ./node_modules/ws/lib/validation.js
@ ./node_modules/ws/lib/receiver.js
@ ./node_modules/ws/index.js
@ ./server.ts
WARNING in ./node_modules/bindings/bindings.js
81:43-53 Critical dependency: the request of a dependency is an expression
@ ./node_modules/bindings/bindings.js
@ ./node_modules/utf-8-validate/index.js
@ ./node_modules/ws/lib/validation.js
@ ./node_modules/ws/lib/receiver.js
@ ./node_modules/ws/index.js
@ ./server.ts
WARNING in ./node_modules/@angular/core/fesm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ ./server.ts 5560:15-36 7:13-37
WARNING in ./node_modules/@angular/core/fesm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ ./server.ts 5572:15-102 7:13-37
Did you ever encountered these? 你有没有遇到过这些? how could I get rid of these?
我该如何摆脱这些?
I believe you can resolve this by adding following to your "webpack.server.config.js" file: 我相信您可以通过将以下内容添加到“ webpack.server.config.js”文件中来解决此问题:
... plugins: [ // Temporary Fix for issue: https://github.com/angular/angular/issues/11580 // for 'WARNING Critical dependency: the request of a dependency is an expression' new webpack.ContextReplacementPlugin( /(.+)?angular(\\\\|\\/)core(.+)?/, path.join(__dirname, 'src'), // location of your src {} // a map of your routes ), new webpack.ContextReplacementPlugin( /(.+)?express(\\\\|\\/)(.+)?/, path.join(__dirname, 'src'), {} ) ] ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.