Closed KrakenTyio closed 3 years ago
Transferring to the CLI project.
The legacy build pipeline doesn't exist anymore in v12.
As for your perf problems, they might be related to the adoption of incremental type-checking using TypeScript's incremental APIs, but it's only guessing at this time. Can you share the project (privately, if needed) or provide CPU profiles so we can get a better understanding of that's going on?
Was ng update
used to update and migrate the project? If so, was a custom and/or third-party builder present when the update took place?
If possible, please provide the the base and configuration options used when performing the build/serve from within angular.json
.
The automatic migrations performed during the update process account for breaking changes when updating to a new major version. Unfortunately, custom and third-party builders cannot be automatically migrated via the official builder migrations as the behavior, available options, and default option values are not known or managed by the Angular team. Ideally such builders should provide their own migrations and some of these builders may not yet be fully compatible with Angular v12.
This is of particular relevance for the symptoms shown above as several of the official builder options pertaining to production builds were altered. The automatic update migrations will adjust the options to retain prior behavior for the official builders. However, if the migrations were not applied or custom/third-party builders were present, existing projects may be performing production-like builds when development behavior is expected (e.g., ng serve
). This would include abnormally long development build/re-build times.
Regarding the Node.js version, v15 is not considered a production-ready version of Node.js and is not recommended for use with the Angular CLI. Node.js v14 is the recommended version for use with the Angular CLI at this time. This, however, is probably not the cause of the performance concerns.
Upgrade did by regular steps from https://update.angular.io/?l=3&v=11.0-12.0 Angular.json ill provide but cpu profile will be generate later
For faster generating, can you provide syntax and steps for generating cpu profile for build process?
Hi @KrakenTyio,
Since you use custom builders, you need to apply the breaking changes in angular.json manually, unless the builder you use provide it own migration. See https://github.com/angular/angular-cli/releases/tag/v12.0.0 for more information about the breaking changes.
Since you are using Node.js 14 you can use the --cpu-proof
argument to generate a CPU profile.
node --cpu-proof node_modules/@angular/cli/lib/init.js serve
Hi there cpu profile and trace resolution its contain first build and also adding one change in app.ts (one if condition with console.log(1)) and revert this change also its generated by node 14 lts docker docker has allowed 12GB ram, its consule almost full 12gb in first rebuild, after build it stay in 6gb, when run rebuil it takes avr 6-8gb ram timing was some in 250-260s and rebuild 35-45s, just note it, in LEGACY build ang 11 it takes max 110s and 4-6s
npm: 7.18.1 node: v14.17.1
installed by: npm i --no-optional --legacy-peer-deps
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"defaultProject": "sandbox",
"cli": {
"analytics": false,
"packageManager": "npm"
},
"projects": {
"sandbox": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "cp",
"i18n": {
"sourceLocale": "en-GB",
"locales": {
"nl-BE": "src/locale/messages.nl-BE.xlf",
"nl-NL": "src/locale/messages.nl-NL.xlf",
"fr-BE": "src/locale/messages.fr-BE.xlf",
"de-DE": "src/locale/messages.de-DE.xlf"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "build/sandbox",
"index": "src/index.html",
"main": "src/app.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"sourceMap": {
"scripts": true,
"styles": true,
"vendor": false
},
"assets": [
{
"glob": "favicon-32x32.png",
"input": "nui/assets/favicons/",
"output": "/favicons/"
},
{
"glob": "*",
"input": "assets",
"output": "/public/images/"
},
{
"glob": "*",
"input": "config/init/",
"output": "/config/init/"
}
],
"styles": ["src/style.scss"],
"stylePreprocessorOptions": {
"includePaths": ["nui", "node_modules/@syncfusion"]
},
"scripts": [],
"allowedCommonJsDependencies": [
"md5",
"croppie",
"xlsx",
"file-saver",
"node-interval-tree",
"socket.io-client",
"moment-timezone",
"dom-set",
"dom-plane",
"dom-autoscroller",
"zone.js/dist/long-stack-trace-zone",
"querystring"
]
},
"configurations": {
"production": {
"assets": [
{
"glob": "robots.txt",
"input": "nui/assets/",
"output": "/"
},
{
"glob": "humans.txt",
"input": "nui/assets/",
"output": "/"
},
{
"glob": "**/*",
"input": "nui/assets/favicons/",
"output": "/favicons/"
},
{
"glob": "*",
"input": "assets",
"output": "/public/images/"
},
{
"glob": "*",
"input": "config/init/",
"output": "/config/init/"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"localize": true,
"statsJson": false,
"optimization": true,
"outputHashing": "all",
"sourceMap": {
"scripts": true,
"styles": true,
"vendor": false,
"hidden": true
},
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": true,
"budgets": [
{
"type": "bundle",
"name": "main",
"maximumWarning": "700kb",
"maximumError": "1mb"
},
{
"type": "initial",
"maximumWarning": "1500kb",
"maximumError": "3mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "50kb"
},
{
"type": "anyScript",
"maximumWarning": "1mb",
"maximumError": "5mb"
}
]
},
"be": {
"localize": ["nl-BE"]
},
"nl": {
"localize": ["nl-NL"]
},
"fr": {
"localize": ["fr-BE"]
},
"de": {
"localize": ["de-DE"]
},
"prod-stats": {
"browserTarget": "sandbox:build:production",
"statsJson": true,
"namedChunks": true,
"extractLicenses": false,
"outputHashing": "none"
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sandbox:build",
"port": 8080
},
"configurations": {
"production": {
"browserTarget": "sandbox:build:production"
},
"be": {
"browserTarget": "sandbox:build:be"
},
"nl": {
"browserTarget": "sandbox:build:nl"
},
"fr": {
"browserTarget": "sandbox:build:fr"
},
"de": {
"browserTarget": "sandbox:build:de"
},
"jit": {
"aot": false,
"sourceMap": {
"scripts": true,
"styles": false,
"vendor": false
}
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sandbox:build",
"format": "xlf2",
"outputPath": "src/locale",
"outFile": "messages.xlf"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"codeCoverage": true,
"sourceMap": {
"scripts": true,
"styles": false,
"vendor": false
},
"styles": [],
"scripts": []
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "sandbox:serve"
},
"configurations": {
"production": {
"devServerTarget": "sandbox:serve:production"
},
"noserve": {
"devServerTarget": ""
},
"sandbox": {
"devServerTarget": "",
"baseUrl": "https://app.mvp-dev.aws.crossuite.com"
}
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"],
"exclude": ["**/node_modules/**"]
}
}
}
}
}
}
As suspected the angular.json was not updated to reflect the new defaults of Angular CLI, which is causing development builds to be fully optimised and slow rebuild times.
Please make sure that you are on the latest version of @angular/cli
and run the below.
ng update @angular/cli —-migrate-only update-angular-config-v12
@alan-agius4 you right, now its better 1 build 98s rebuild 14s->5s->4.5s->5s
probably when i did migrate it was there builders with custom-webpack and not move properties right now with angular-devkit builders it do pretty much stuffs
after upgrade angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"defaultProject": "sandbox",
"cli": {
"analytics": false,
"packageManager": "npm"
},
"projects": {
"sandbox": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "cp",
"i18n": {
"sourceLocale": "en-GB",
"locales": {
"nl-BE": "src/locale/messages.nl-BE.xlf",
"nl-NL": "src/locale/messages.nl-NL.xlf",
"fr-BE": "src/locale/messages.fr-BE.xlf",
"de-DE": "src/locale/messages.de-DE.xlf"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "build/sandbox",
"index": "src/index.html",
"main": "src/app.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"sourceMap": {
"scripts": true,
"styles": true,
"vendor": false
},
"assets": [
{
"glob": "favicon-32x32.png",
"input": "nui/assets/favicons/",
"output": "/favicons/"
},
{
"glob": "*",
"input": "assets",
"output": "/public/images/"
},
{
"glob": "*",
"input": "config/init/",
"output": "/config/init/"
}
],
"styles": ["src/style.scss"],
"stylePreprocessorOptions": {
"includePaths": ["nui", "node_modules/@syncfusion"]
},
"scripts": [],
"allowedCommonJsDependencies": [
"md5",
"croppie",
"xlsx",
"file-saver",
"node-interval-tree",
"socket.io-client",
"moment-timezone",
"dom-set",
"dom-plane",
"dom-autoscroller",
"zone.js/dist/long-stack-trace-zone",
"querystring"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"assets": [
{
"glob": "robots.txt",
"input": "nui/assets/",
"output": "/"
},
{
"glob": "humans.txt",
"input": "nui/assets/",
"output": "/"
},
{
"glob": "**/*",
"input": "nui/assets/favicons/",
"output": "/favicons/"
},
{
"glob": "*",
"input": "assets",
"output": "/public/images/"
},
{
"glob": "*",
"input": "config/init/",
"output": "/config/init/"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"localize": true,
"statsJson": false,
"optimization": true,
"outputHashing": "all",
"sourceMap": {
"scripts": true,
"styles": true,
"vendor": false,
"hidden": true
},
"namedChunks": false,
"extractLicenses": true,
"buildOptimizer": true,
"budgets": [
{
"type": "bundle",
"name": "main",
"maximumWarning": "700kb",
"maximumError": "1mb"
},
{
"type": "initial",
"maximumWarning": "1500kb",
"maximumError": "3mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "50kb"
},
{
"type": "anyScript",
"maximumWarning": "1mb",
"maximumError": "5mb"
}
]
},
"be": {
"localize": ["nl-BE"]
},
"nl": {
"localize": ["nl-NL"]
},
"fr": {
"localize": ["fr-BE"]
},
"de": {
"localize": ["de-DE"]
},
"prod-stats": {
"browserTarget": "sandbox:build:production",
"statsJson": true,
"outputHashing": "none"
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sandbox:build",
"port": 8080
},
"configurations": {
"production": {
"browserTarget": "sandbox:build:production"
},
"be": {
"browserTarget": "sandbox:build:be"
},
"nl": {
"browserTarget": "sandbox:build:nl"
},
"fr": {
"browserTarget": "sandbox:build:fr"
},
"de": {
"browserTarget": "sandbox:build:de"
},
"jit": {
"aot": false,
"sourceMap": {
"scripts": true,
"styles": false,
"vendor": false
}
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sandbox:build",
"format": "xlf2",
"outputPath": "src/locale",
"outFile": "messages.xlf"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"codeCoverage": true,
"sourceMap": {
"scripts": true,
"styles": false,
"vendor": false
},
"styles": [],
"scripts": []
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "sandbox:serve"
},
"configurations": {
"production": {
"devServerTarget": "sandbox:serve:production"
},
"noserve": {
"devServerTarget": ""
},
"sandbox": {
"devServerTarget": "",
"baseUrl": "https://app.mvp-dev.aws.crossuite.com"
}
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"],
"exclude": ["**/node_modules/**"]
}
}
}
}
}
}
@KrakenTyio, so issue resolved correct?
Yes, we are on same time like before with legacy
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
After upgrade to latest angular 12.1, and few minutes i figure out
NG_BUILD_IVY_LEGACY
is not working anymore.(almost all extra configs from custom-webpack i adapt to work)
Last angular 11.x i run like
NG_BUILD_IVY_LEGACY=1 ng serve
in docker container (node 15) and takes in our project 1 build: ~105s and rebuild ~4-5snow no matter if i have
NG_BUILD_IVY_LEGACY
or not it takes 1 build: ~240s and rebuild ~85sIts not much cool
Same result is also without custom-webpack with regular schema for angular.json
npm ls