23

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

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,}
4

2 回答 2

40

import如果您将主题声明替换如下,该问题将在 Angular 10 及更高版本中得到解决。

代替:

import { Subject } from "rxjs/Subject";

和:

import { Subject } from "rxjs";
于 2020-09-30T23:00:50.167 回答
0

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

于 2021-08-27T14:22:26.083 回答