2

This is currently my logging from an Angular build:

./angular/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Found non-callable @@iterator

./angular/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Found non-callable @@iterator

✖ Failed to compile.

But my polyfills and main.ts haven't really differed from the default implementation.
And the upgrade guide from Angular itself didn't mention editing the polyfill or main.

main.ts

import '@datx/core/disable-mobx';
import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app/app.module';
import {environment} from './environments/environment';
import {init} from '@sentry/angular';
import {Integrations as TracingIntegrations} from '@sentry/tracing';

init({
    dsn: environment.sentry_dsn,

    // This enables automatic instrumentation (highly recommended), but is not
    // necessary for purely manual usage
    integrations: [new TracingIntegrations.BrowserTracing()],

    // To set a uniform sample rate
    tracesSampleRate: environment.sentry_trace_sample_rate,

    // Set the environment where sentry needs to post to.
    environment: environment.type,
});


if (environment.production) {
    enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
    .catch(err => console.error(err));

polyfills.ts

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js'; // Included with Angular CLI.


/***************************************************************************************************
 * APPLICATION IMPORTS
 */

(window as any).global = window;

I would have expected to have a build

1 Answers1

0

Have you aligned your Angular version with a compatible TypeScript version? It is marked as a breaking change. https://angular.io/guide/update-to-version-15#angular-v15-supports-typescript-version-48-or-later

Angular v15 supports TypeScript version 4.8 or later

npm install -g typescript@latest where -g is for global.

In case you need here are the steps to upgrade from 14 -> 15: https://update.angular.io/?l=2&v=14.0-15.0

Joosep Parts
  • 5,372
  • 2
  • 8
  • 33
  • Thanks for the response. I have ran the yarn list command and the result for typescript is: typescript@4.8.4. Which is also defined inside my package.json devDependencies list. – Stefan Willems Mar 30 '23 at 10:32