Module build error: RangeError: Maximum call stack size exceeded after upgrade to Ionic 3

I just updated my Ionic 2 app to Ionic 3, all frameworks, Ionic native and CLI.

Now I have the following setup.

    "dependencies": {
        "@angular/animations": "4.1.0",
        "@angular/common": "4.1.0",
        "@angular/compiler": "4.1.0",
        "@angular/compiler-cli": "4.1.0",
        "@angular/core": "^4.1.0",
        "@angular/forms": "4.1.0",
        "@angular/http": "^4.1.0",
        "@angular/platform-browser": "4.1.0",
        "@angular/platform-browser-dynamic": "4.1.0",
        "@ionic-native/app-version": "^3.8.0",
        "@ionic-native/core": "3.6.1",
        "@ionic-native/device": "^3.8.0",
        "@ionic-native/file": "^3.7.0",
        "@ionic-native/network": "^3.8.0",
        "@ionic-native/social-sharing": "^3.7.0",
        "@ionic-native/splash-screen": "3.6.1",
        "@ionic-native/status-bar": "3.6.1",
        "@ionic-native/toast": "^3.8.0",
        "@ionic/storage": "2.0.1",
        "c3": "^0.4.11",
        "ionic-angular": "3.2.1",
        "ionicons": "3.0.0",
        "js-logger": "^1.3.0",
        "jslogger": "^1.0.3",
        "jszip": "^3.1.3",
        "lodash": "^4.17.4",
        "moment": "^2.17.1",
        "moment-duration-format": "^1.3.0",
        "ng2-translate": "^5.0.0",
        "rxjs": "5.1.1",
        "semaphore-async-await": "^1.3.2",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.10"
      },
      "devDependencies": {
        "@ionic/app-scripts": "1.3.7",
        "@ionic/cli-plugin-ionic-angular": "1.0.0",
        "@types/c3": "^0.4.38",
        "@types/jasmine": "^2.5.42",
        "@types/jszip": "0.0.32",
        "@types/lodash": "^4.14.51",
        "@types/moment-duration-format": "^1.3.1",
        "@types/node": "^7.0.5",
        "codecov": "^1.0.1",
        "install": "^0.8.7",
        "jasmine-core": "^2.5.2",
        "jasmine-spec-reporter": "^3.2.0",
        "karma": "^1.4.1",
        "karma-chrome-launcher": "^2.0.0",
        "karma-jasmine": "^1.1.0",
        "karma-mocha-reporter": "^2.2.2",
        "karma-remap-istanbul": "^0.6.0",
        "ts-node": "^2.1.0",
        "tslint": "^4.4.2",
        "tslint-eslint-rules": "^3.3.0",
        "typescript": "^2.2.1"
      },

      

Now if I build with the -prod flag (without it it is id) I get the following error ...

    [16:50:08]  webpack started ...
    Error: ./~/jszip/lib/index.js
    Module build failed: RangeError: Maximum call stack size exceeded
        at Object.forEachChild (D:\dev\myapp\node_modules\typescript\lib\typescript.js:14735:26)
        at traverse (D:\dev\myapp\node_modules\typescript\lib\typescript.js:7271:31)
        at Object.forEachReturnStatement (D:\dev\myapp\node_modules\typescript\lib\typescript.js:7251:16)
        at checkAndAggregateReturnExpressionTypes (D:\dev\myapp\node_modules\typescript\lib\typescript.js:40055:16)
        at getReturnTypeFromBody (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39965:29)
        at getReturnTypeOfSignature (D:\dev\myapp\node_modules\typescript\lib\typescript.js:31190:28)
        at resolveNewExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39483:21)
        at resolveSignature (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39639:28)
        at getResolvedSignature (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39669:26)
        at checkCallExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39696:29)
     @ ./src/providers/file-logger.ts 58:0-28
     @ ./src/app/app.module.ngfactory.ts
     @ ./src/app/main.ts,./~/d3/d3.js
    Module build failed: RangeError: Maximum call stack size exceeded
        at RegExp.[Symbol.replace] (native)
        at String.replace (native)
        at formatStringFromArgs (D:\dev\myapp\node_modules\typescript\lib\typescript.js:2365:21)
        at Object.chainDiagnosticMessages (D:\dev\myapp\node_modules\typescript\lib\typescript.js:2433:20)
        at reportNonexistentProperty (D:\dev\myapp\node_modules\typescript\lib\typescript.js:38290:28)
        at checkPropertyAccessExpressionOrQualifiedName (D:\dev\myapp\node_modules\typescript\lib\typescript.js:38332:
    21)
        at checkPropertyAccessExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:38274:20)
        at checkExpressionWorker (D:\dev\myapp\node_modules\typescript\lib\typescript.js:41158:28)
        at checkExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:41115:42)
        at checkExpressionWithContextualType (D:\dev\myapp\node_modules\typescript\lib\typescript.js:40983:26)
     @ ./src/pages/mypage/mypage.ts 61:0-25
     @ ./src/app/app.module.ts
     @ ./src/app/app.module.ngfactory.ts
     @ ./src/app/main.ts

      

I tracked this down to 2 libs C3 / D3 and jszip . If I use any of these in a small newly created Ionic 3 app then the problem is not .

I've looked at a lot of other posts about webpack throwing this error, but just can't figure out why this is happening now for me in my existing project.

This happens for either the newer version of Ionic CLI version 3, or the older version (2.2.3) when I downgraded it.

[Update1]

Working on a second machine (Windows 10) with node v6.9.4 (above was node 7.something) and npm 4.2.0, I get a similar but differently formatted error ...

    [16:31:04]  webpack started ...
    [16:31:35]  webpack finished in 31.23 s
    [16:31:35]  sass started ...
    [16:31:36]  transpile bundle started ...
    [16:31:44]  build prod failed: Maximum call stack size exceeded
    [16:31:44]  ionic-app-script task: "build"
    [16:31:44]  RangeError: Maximum call stack size exceeded
    RangeError: Maximum call stack size exceeded
        at checkNonNullExpression (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:38258:40)
        at resolveNewExpression (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:39433:34)
        at resolveSignature (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:39639:28)
        at getResolvedSignature (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:39669:26)
        at checkCallExpression (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:39696:29)
        at checkExpressionWorker (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:41163:28)
        at checkExpression (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:41115:42)
        at checkExpressionCached (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:40996:38)
        at H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:40058:32
        at traverse (H:\dev\myapp\upgradeto3\node_modules\typescript\lib\typescript.js:7255:28)

      

[UPDATE2]

As another test, I added a new blank page and added nothing but C3 imports and then calling one function (generation) from the library.

This new page is getting the same error.

Does anyone have an idea on how to track this issue / fix this issue? I am out of ideas and I just cannot start the project again from empty.

Thanks in advance for your help

[Update3]

I thought I would try to update TypeScript to the latest 2.3.2. When I restarted the npm install I get some warnings.

    +-- UNMET PEER DEPENDENCY @angular/core@4.1.0
    +-- UNMET PEER DEPENDENCY @angular/http@4.1.0
    `-- typescript@2.3.2

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (curre
    nt: {"os":"win32","arch":"x64"})
    npm WARN ng2-translate@5.0.0 requires a peer of @angular/core@^2.0.0 but none was installed.
    npm WARN ng2-translate@5.0.0 requires a peer of @angular/http@^2.0.0 but none was installed.

      

I don't quite understand two UNMET PEER DEPENDENCY

, since I have exactly set @angular/core@4.1.0

and @angular/http@4.1.0

.

Anyway, I still get the same overflow. Not really sure what to try next. Once again, these libraries build nicely in a newly created Ionic app, maybe because it's so much smaller?

Also I found this problem , but it is slightly different from mine here ...

+3


source to share


2 answers


For me the solution was to have the latest Ionic including the latest CLI except containing TypeScript in 2.3.0 as suggested by imgx64 here



+1


source


Similar error on startup ionic cordova build browser --prod

after uptdate from Ionic 3.2.1 to 3.3.0. This only happens when using a parameter --prod

.

Error log:



$ ionic cordova build browser --prod
Running app-scripts build: --prod --iscordovaserve --externalIpRequired --nobrowser

    [13:22:25]  build prod started ...
    [13:22:25]  clean started ...
    [13:22:25]  clean finished in 16 ms
    [13:22:25]  copy started ...
    [13:22:25]  ngc started ...
    [13:22:37]  ngc finished in 11.64 s
    [13:22:37]  preprocess started ...
    [13:22:37]  deeplinks started ...
    [13:22:37]  deeplinks finished in 594 ms
    [13:22:37]  optimization started ...
    [13:22:38]  copy finished in 12.65 s
    [13:22:57]  optimization finished in 19.56 s
    [13:22:57]  preprocess finished in 20.15 s
    [13:22:57]  webpack started ...
    [WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of date.
    Error: ./~/d3/d3.js
    Module build failed: RangeError: Maximum call stack size exceeded
        at checkNonNullExpression (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:38397:40)
        at checkPropertyAccessExpressionOrQualifiedName (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:38455:24)
        at checkPropertyAccessExpression (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:38413:20)
        at checkExpressionWorker (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:41300:28)
        at checkExpression (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:41257:42)
        at checkBinaryLikeExpression (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:40834:28)
        at checkBinaryExpression (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:40827:20)
        at checkExpressionWorker (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:41335:28)
        at checkExpression (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:41257:42)
        at checkBinaryLikeExpression (C:\Projetos\MyProject\Frontend\node_modules\typescript\lib\typescript.js:40834:28)
     @ ./~/c3/c3.js 830:70-83
     @ ./src/components/c3-chart-component/c3-chart-adapter.ts
     @ ./src/components/c3-chart-component/c3-chart-component.ts
     @ ./src/pages/dashboard/dashboard.ngfactory.ts
     @ ./src/pages/dashboard/dashboard.module.ngfactory.ts
     @ ./src async
     @ ./~/ionic-angular/util/ng-module-loader.js
     @ ./src/app/app.module.ngfactory.ts
     @ ./src/app/main.ts

      

0


source







All Articles