o.Subject 不是构造函数 - Angular 10

o.Subject is not a constructor - Angular 10

Ng serveng build --prod 命令工作正常,但是当我在服务器上部署应用程序时,出现以下错误:-

TypeError: o.Subject is not a constructor
at new e (vendor-esnext.js:1)
at Object.useFactory (vendor-esnext.js:1)
at Object.i [as factory] (vendor-esnext.js:1)
at Xo.hydrate (vendor-esnext.js:1)
at Xo.get (vendor-esnext.js:1)
at Jf.get (vendor-esnext.js:1)
at Object.get (vendor-esnext.js:1)
at Gn (vendor-esnext.js:1)
at Module.Sl (vendor-esnext.js:1)
at Mn.e.ɵfac [as factory] (vendor-esnext.js:1)

tsconfig.base.json

{"compilerOptions": {
"baseUrl": "",
"allowSyntheticDefaultImports": true,
"declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
  "dom",
  "es2017"
],
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"target": "ESNext",
"paths": {
  "@angular/*": [
    "node_modules/@angular/*"
  ]
}},"include": [
"src/**/*.ts",
"node_modules/ng4-fittext/*.d.ts"],"exclude": [],"compileOnSave": false,}

问题将在Angular 10 及更高版本中解决,如果您将 import 语句替换为 主题如下。

替换:

import { Subject } from "rxjs/Subject";

与:

import { Subject } from "rxjs";

如果你来这里解决angular-2-dropdown-multiselect的问题,只需更新到最新版本。(实际上是1.9.0)。