ng build --configuration=production --base-href /my-app/ --prod
generally this is my way of building my angular 8 app for production. however in my current app it is giving me an error while compiling.
ERROR in Illegal State: referring to a type without a variable {"filePath":"/node_modules/@angular/router/router.d.ts","name":"RouterLink","members":[]}
Quick search suggested to set build-optimizer
& aot
flags to false
. The build process is successful on executing:
ng build --configuration=production --base-href /my-app/ --prod --build-optimizer=false --aot=false
I have two queries:
What is the
referring to a type without a variable error
issue? I don't mind sharing my code, but unable to understand what part of the code should be shared as i couldn't understand the relevance of the error.Is it okay to set
aot
to false? A medium blog suggestsThe performance improvements with AOT are too significant to ignore
My package.json is as follows
{
"name": "my-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/fire": "^5.2.1",
"@angular/forms": "~8.2.0",
"@angular/material": "^8.1.4",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"ag-grid-angular": "^21.2.1",
"ag-grid-community": "^21.2.1",
"ag-grid-enterprise": "^21.2.1",
"angular-persistence": "^1.0.1",
"firebase": "^6.5.0",
"ng-zorro-antd": "^8.2.1",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.5.3",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.802.2",
"@angular/cli": "~8.2.2",
"@angular/compiler-cli": "~8.2.0",
"@angular/language-service": "~8.2.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}