我有一个 angular 8 的应用程序,突然间,我生成的每个构建版本和在生产中部署的新版本都开始引发大量错误。
这些是我的 Angular 相关依赖项:
"dependencies": {
"@angular/animations": "~8.0.0",
"@angular/common": "~8.0.0",
"@angular/compiler": "~8.0.0",
"@angular/core": "~8.0.0",
"@angular/forms": "~8.0.0",
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
这些是我的 Angular 相关开发依赖项:
"devDependencies": {
"@angular-devkit/build-angular": "~0.800.0",
"@angular/cli": "~8.0.2",
"@angular/compiler-cli": "~8.0.0",
"@angular/language-service": "~8.0.0",
"@babel/core": "^7.3.4",
"@storybook/angular": "^5.1.4",
"@types/jasmine": "~3.3.13",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.0.8"
我的 angular.json 生产配置:
"optimization": true,
"outputHashing": "none",
"sourceMap": true,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
我的 tsconfig.json 文件:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": [
"node_modules/@types",
"src/modules.d.ts"
],
"lib": [
"es2018",
"dom"
],
"paths": { "@angular/*": ["./node_modules/@angular/*"] }
}
}
现在列出一些错误:
TypeError
f.ngDoCheck is not a function. (In 'f.ngDoCheck()', 'f.ngDoCheck' is undefined)
./node_modules/@angular/core/fesm5/core.js.pre-build-optimizer.js in checkAndUpdateNode at line 19344:19
if ((def.flags & 65536 /* OnInit */) &&
shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) {
directive.ngOnInit();
}
if (def.flags & 262144 /* DoCheck */) {
directive.ngDoCheck();
}
return changed;
Error
Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at __webpack_require__ (URL)
at ZoneDelegate.push../node_mod...
webpack/bootstrap in __webpack_require__ at line 83:1
l: false,
exports: {}
};
// Execute the module function
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
TypeError
this._delegate.applyChanges is not a function
./node_modules/@angular/common/fesm5/common.js.pre-build-optimizer.js in ngDoCheck at line 3832:30
}
else {
var view = _this._viewContainer.get(adjustedPreviousIndex);
_this._viewContainer.move(view, currentIndex);
var tuple = new RecordViewTuple(item, view);
insertTuples.push(tuple);
我试图解决的问题:
"devDependencies": { "@angular-devkit/architect": "~0.803.20", "@angular-devkit/build-angular": "~0.803.20", "@angular-devkit/core": "~8.3.20", "@angular-devkit/schematics": "~8.3.20", },
如果有人能帮助我,我会很感激,我很绝望。