Feathers: Angular 10 中的优化警告

创建于 2020-06-28  ·  3评论  ·  资料来源: feathersjs/feathers

重现步骤

在将Angular应用程序升级到

用于警告的 PSB 日志

WARNING in src/app/core/services/feathers.service.ts depends on @feathersjs/socketio-client. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in src/app/core/services/feathers.service.ts depends on @feathersjs/feathers. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in src/app/core/services/feathers.service.ts depends on @feathersjs/authentication-client. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in src/app/core/services/feathers.service.ts depends on socket.io-client. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

WARNING in src/app/core/services/feathers.service.ts depends on feathers-reactive. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

系统配置

模块版本
@feathersjs/authentication-client:“^4.5.4”
@feathersjs/feathers:“^4.5.3”
@feathersjs/socketio-client:“^4.5.4”
socket.io-客户端:“^2.3.0”

NodeJS 版本
节点 12

操作系统
Linux 薄荷 19.3

Client Feature

最有用的评论

应添加 ESM 构建以正确修复这些警告。

所有3条评论

嗨 arkenstan 我解决了在 angular.json 文件中添加这个警告的问题

`
“建筑师”:{
“建造”: {
"builder": "@angular-devkit/build- angular:browser ",
“选项”: {
“allowedCommonJsDependencies”:[
"socket.io-client",
"socket.io-解析器",
“调试”
],

`
你也可以看到#18025

应添加 ESM 构建以正确修复这些警告。

有同样的问题警告:入口点 simplebar-angular 包含深度导入
尝试在“build”=>“options”中添加 angular.json:

"allowedCommonJsDependencies": ["core-js"],

我还记得在 tsconfig.json 中添加了一些东西
这里有帮助的是我的案例检查与默认设置

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./public/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "allowSyntheticDefaultImports": true,
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}
此页面是否有帮助?
0 / 5 - 0 等级