I wanted to add a question within the comment section of this post: Angular 2 AOT vs JIT, but I don't have enough rep points yet.
I have an Angular app that shows errors when I build but not in dev. I understand the desire to get quick feedback in dev but for this application it is causing issues in the gratification of quick deployment after working in the dev enviroment for extended time. Instead of doing ng serve
to get the feedback and then do ng build
right after to make sure at a later time I will be able to deploy; is there a flag I can add to ng serve
that will do this for me?
At the moment I use ng serve --aot
but that is not strict enough to show errors that will fail at build. Right now the application I have is not that big, so I will find it acceptable if my ng serve
loads slower.
Here's a snippet of my package.json:
{
"name": "XXXXXXX",
"url": "XXXXXXX",
"version": "0.0.1",
"scripts": {
"ng": "ng",
"start": "ng serve --aot",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.1.2",
"@angular/cdk": "^5.0.2",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^5.0.2",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"angular2-jwt": "^0.2.3",
},
"devDependencies": {
"@angular/cli": "^1.5.5",
"@angular/compiler-cli": "^5.0.0",
"@types/google.analytics": "0.0.36",
"@types/jasmine": "^2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "^2.0.0",
"tslint": "~4.5.0",
"typescript": "^2.4.2"
}
}