I have an Angular 11.1 application and if I build it with the setting buildOptimizer set to true in angular.json, it builds with no errors and loads with no errors but it doesn't work correctly. Some pages will hang and others won't have the screens rendered correctly. Some pages work fine and there are no errors. If I build it with this setting set to false everything works correctly.
I'm looking for some way to find out what is wrong because it builds and runs without any errors. Any ideas or help would be greatly appreciated.
Thanks
My angular.json:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"myproject": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"msgpack5",
"@progress/kendo-angular-intl/locales/en-GB/all",
"@progress/kendo-angular-intl/locales/en/all",
"@progress/kendo-angular-intl/locales/en-AU/all",
"file-saver",
"xlsx",
"hammerjs"
],
"aot": true,
"progress": false,
"verbose": false,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.browser.ts",
"polyfills": "src/polyfills/browser.polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/assets",
"src/favicon.ico",
"src/favicon.svg"
],
"styles": [
"node_modules/@ng-select/ng-select/themes/material.theme.css",
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/themes/mdc-light-deeppurple/theme.css",
"node_modules/primeng/resources/primeng.css",
"node_modules/tippy.js/dist/backdrop.css",
"node_modules/tippy.js/dist/svg-arrow.css",
"node_modules/tippy.js/dist/tippy.css",
"node_modules/tippy.js/themes/material.css",
"src/cb-theme.scss",
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "10mb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": {
"scripts": false,
"styles": false,
"vendor": false
},
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "cb:build"
},
"configurations": {
"production": {
"browserTarget": "cb:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "cb:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills/browser.polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/cb-theme.scss",
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/assets",
"src/favicon.ico",
"src/favicon.svg"
]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options":
{
"lintFilePatterns":
[
"src/**/*.ts",
"src/**/*.html"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist-server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"dev": {
"optimization": true,
"outputHashing": "all",
"sourceMap": {
"scripts": true,
"styles": true,
"vendor": true
},
"namedChunks": false,
"extractLicenses": true
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": {
"scripts": false,
"styles": false,
"vendor": false
},
"namedChunks": false,
"extractLicenses": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "10mb"
}
]
}
}
}
}
},
"cb-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "cb:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "cb",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
}
}