You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: NG0908: In this configuration Angular requires Zone.js
At this stage, locally everything works fine with $ ng serve.
So to solve the problem in StackBlitz, I have to import zone.js in main.ts:
import'zone.js/dist/zone';// Avoid error in StackBlitzimport{platformBrowserDynamic}from'@angular/platform-browser-dynamic';import{AppModule}from'./app/app.module';platformBrowserDynamic().bootstrapModule(AppModule).catch(err=>console.error(err));
After that, everything worked perfectly on StackBlitz:
But triggers a warning locally with $ ng serve:
Warning: .../angular-stackblitz/src/main.ts depends on 'zone.js/dist/zone'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Steps to Reproduce
I generate locally a complete Angular project with a global Angular CLI 15.1.5 with the following command:
$ ng new app --directory ./ --skip-git true --routing --style scss --defaults --strict
Ya.. this was changed in Angular. Polyfills are now done via the angular.json's polyfills build option property. You supply the zone.js polyfill there instead of via the TS polyfills file. This is a major bummer... Does stackblitz not really respect the angular.json configuration?
Hi!
Description of Bug
In my GitHub repository, Angular CLI locally generates by default the
main.ts
file withoutzone.js
:Which creates an error (NG0908) when I launch the project in StackBlitz:
At this stage, locally everything works fine with
$ ng serve
.So to solve the problem in StackBlitz, I have to import
zone.js
inmain.ts
:After that, everything worked perfectly on StackBlitz:
But triggers a warning locally with
$ ng serve
:Steps to Reproduce
I save the generated application in my GitHub repository (https://github.com/jprivet-dev/angular-stackblitz).
I launch the project in StackBlitz: https://stackblitz.com/github/jprivet-dev/angular-stackblitz/tree/main.
I launch the project locally with
$ ng serve
.Expected Behavior
I am looking for a single solution without
zone.js
, to make everything works, without errors and alerts, in StackBlitz and locally with$ ng serve
.Thank you in advance for your help 😊
The text was updated successfully, but these errors were encountered: