Error TS2563: The containing function or module body is too large for control flow analysis

Discussão em 'Angular' iniciado por Sahil Bhatoa, Março 27, 2025.

  1. Sahil Bhatoa

    Sahil Bhatoa Guest

    I upgraded my package.json in angular project. The migration was done from Angular 6 to 7. When I try to build, I saw this error in the console.

    Error TS2563: The containing function or module body is too large for control flow analysis.

    Here is my new package.json

    {
    "name": "e-case-prototype",
    "version": "0.0.0",
    "license": "MIT",
    "scripts": {
    "ng": "ng",
    "start": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng serve --proxy-config proxy.conf.json --source-map=false",
    "build": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build",
    "build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod",
    "build-prod-aot-disabled": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod --aot false --build-optimizer false",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
    "@angular-devkit/build-angular": "^0.13.9",
    "@angular/animations": "7.2.15",
    "@angular/cdk": "7.3.7",
    "@angular/common": "7.2.15",
    "@angular/compiler": "7.2.15",
    "@angular/core": "7.2.15",
    "@angular/flex-layout": "^7.0.0-beta.24",
    "@angular/forms": "7.2.15",
    "@angular/http": "7.2.15",
    "@angular/material": "7.3.7",
    "@angular/platform-browser": "7.2.15",
    "@angular/platform-browser-dynamic": "7.2.15",
    "@angular/router": "7.2.15",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@swimlane/ngx-charts": "11.1.0",
    "@types/moment-timezone": "^0.5.12",
    "angular-calendar": "^0.27.8",
    "angular-draggable-droppable": "^4.3.0",
    "angular-in-memory-web-api": "0.8.0",
    "angular-resizable-element": "^3.2.4",
    "chart.js": "^2.8.0",
    "classlist.js": "^1.1.20150312",
    "codelyzer": "^5.0.1",
    "core-js": "^2.5.7",
    "date-fns": "^1.30.1",
    "hammerjs": "2.0.8",
    "intl": "1.2.5",
    "jquery": "^3.4.1",
    "luxon": "^1.15.0",
    "moment": "2.24.0",
    "moment-timezone": "^0.5.25",
    "ng-dynamic-component": "^4.0.3",
    "ng2-charts": "2.2.3",
    "ng2-dnd": "5.0.2",
    "ngx-captcha": "^6.4.0",
    "ngx-color-picker": "7.5.0",
    "ngx-cookie-service": "2.2.0",
    "ngx-material-timepicker": "^3.1.0",
    "ngx-quill": "^5.1.0",
    "npm-check": "^5.9.0",
    "perfect-scrollbar": "1.4.0",
    "prismjs": "1.16.0",
    "quill": "^1.3.6",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.5.2",
    "systemjs": "^3.1.6",
    "tslib": "^1.9.3",
    "web-animations-js": "^2.3.1",
    "zone.js": "0.9.1"
    },
    "devDependencies": {
    "@angular/cli": "7.3.9",
    "@angular/compiler-cli": "7.2.15",
    "@angularclass/hmr": "2.1.3",
    "@types/jasmine": "3.3.12",
    "@types/jasminewd2": "2.0.6",
    "@types/node": "12.0.2",
    "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.5",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "1.4.2",
    "protractor": "5.4.2",
    "ts-node": "8.1.0",
    "tslint": "5.16.0",
    "typescript": "3.1.6",
    "webpack-bundle-analyzer": "3.3.2"
    }
    }


    Here is the old package.json that was working

    {
    "name": "e-case-prototype",
    "version": "0.0.0",
    "license": "MIT",
    "scripts": {
    "ng": "ng",
    "start": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng serve --proxy-config proxy.conf.json --source-map=false",
    "build": "ng build",
    "build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod",
    "build-prod-aot-disabled": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod --aot false --build-optimizer false",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
    },
    "private": true,
    "dependencies": {
    "@angular-devkit/build-angular": "^0.6.3",
    "@angular/animations": "6.0.2",
    "@angular/cdk": "6.0.2",
    "@angular/common": "6.0.2",
    "@angular/compiler": "6.0.2",
    "@angular/core": "6.0.2",
    "@angular/flex-layout": "5.0.0-beta.14",
    "@angular/forms": "6.0.2",
    "@angular/http": "6.0.2",
    "@angular/material": "6.0.2",
    "@angular/platform-browser": "6.0.2",
    "@angular/platform-browser-dynamic": "6.0.2",
    "@angular/router": "6.0.2",
    "@ngx-translate/core": "^10.0.1",
    "@ngx-translate/http-loader": "^3.0.1",
    "@swimlane/ngx-charts": "8.0.1",
    "@types/moment-timezone": "^0.5.11",
    "angular-calendar": "0.25.2",
    "angular-draggable-droppable": "^3.0.0",
    "angular-in-memory-web-api": "0.6.0",
    "angular-resizable-element": "^3.0.0",
    "classlist.js": "^1.1.20150312",
    "codelyzer": "^4.3.0",
    "core-js": "2.5.6",
    "hammerjs": "2.0.8",
    "intl": "1.2.5",
    "jquery": "^3.3.1",
    "moment": "2.22.1",
    "moment-timezone": "^0.5.23",
    "ng-dynamic-component": "^3.0.0",
    "ng2-charts": "1.6.0",
    "ng2-dnd": "5.0.2",
    "ngx-captcha": "^5.0.3",
    "ngx-color-picker": "6.1.0",
    "ngx-cookie-service": "1.0.10",
    "ngx-material-timepicker": "^2.13.0",
    "ngx-quill": "^3.1.0",
    "npm-check": "^5.7.1",
    "perfect-scrollbar": "1.3.0",
    "prismjs": "1.14.0",
    "quill": "^1.3.6",
    "rxjs": "^6.1.0",
    "rxjs-compat": "^6.1.0",
    "systemjs": "^0.21.4",
    "tslib": "^1.9.2",
    "web-animations-js": "^2.3.1",
    "zone.js": "0.8.26"
    },
    "devDependencies": {
    "@angular/cli": "6.0.3",
    "@angular/compiler-cli": "6.0.2",
    "@angularclass/hmr": "2.1.3",
    "@types/jasmine": "2.8.7",
    "@types/jasminewd2": "2.0.3",
    "@types/node": "10.1.2",
    "jasmine-core": "3.1.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "2.0.2",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "2.0.0",
    "karma-jasmine": "1.1.2",
    "karma-jasmine-html-reporter": "1.1.0",
    "protractor": "5.3.2",
    "ts-node": "6.0.3",
    "tslint": "5.10.0",
    "typescript": "^2.7.2",
    "webpack-bundle-analyzer": "2.13.0"
    }
    }


    I had already tried upgrading to different typescript version. I was limited by Angular as the version has to be between 3.1.1 and 3.3

    The code was compiling on the previous typescript version of ^2.7.2

    Continue reading...

Compartilhe esta Página