I recently tried upgrading Angular 10 to Angular 12. However, when I run the project in the browser, I get this error in the console:
vendor.js:55447 Uncaught TypeError: Cannot read property 'Directive' of undefined
at vendor.js:55447
at vendor.js:54968
at Object.6 (vendor.js:54971)
at __webpack_require__ (polyfills.js:55)
at Object.764 (vendor.js:69649)
at __webpack_require__ (polyfills.js:55)
at Object.763 (vendor.js:69620)
at __webpack_require__ (polyfills.js:55)
at webpackJsonpCallback (polyfills.js:26)
at vendor.js:1
And it happens at this line:
DirectiveSuperclass.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.1", ngImport: i0__namespace, type: DirectiveSuperclass, deps: [{ token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Directive });
particularly, this spot: i0__namespace.ɵɵFactoryTarget.Directive
Any ideas what I could be missing here?
Here's my angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"schematics": {
"@schematics/angular:component": {
"changeDetection": "OnPush",
"style": "scss"
}
},
"projects": {
"workspace": {
"projectType": "library",
"root": "projects/workspace",
"sourceRoot": "projects/workspace/src",
"prefix": "h3",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/workspace/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/workspace/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/workspace/tsconfig.lib.json"
},
"defaultConfiguration": "production"
}
},
}
}
},
"defaultProject": "workspace",
"cli": {
"analytics": false,
"packageManager": "yarn"
}
}