Sandbox to locally generate a project with Angular CLI and launch it online in StackBlitz.
| Label | Version |
|---|---|
node |
v18.13.0 |
npm |
8.19.3 |
Angular |
15.1.5 |
To launch locally that project, you will need to install NVM (Node Version Manager) or Node.
|
📎
|
More information on: |
In my case, I used Node in KDE Neon (see https://github.com/nodejs/snap).
If you want to regenerate a new Angular project, you will need to install/update a global Angular CLI:
$ npm install -g @angular/cli|
📎
|
More information on https://angular.io/cli |
-
$ git clone git@github.com:jprivet-dev/angular-stackblitz.git -
$ cd angular-stackblitz -
$ npm install -
$ ng serve -
Open your browser on http://localhost:4200/
|
📎
|
More information on https://developer.stackblitz.com/guides/integration/open-from-github |
Angular CLI locally generates by default the main.ts file without zone.js:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));Which creates an error (NG0908) when I launch the project in StackBlitz:
Error: NG0908: In this configuration Angular requires Zone.jsAt 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 StackBlitz
import { 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|
|
I created an issue on StackBlitz: stackblitz/core#2366. I am looking for a single solution without Still searching… |
|
📎
|
Based on https://semver.org/ |
v[MAJOR].[ANGULAR_VERSION].[MINOR].[PATCH]
With [ANGULAR_VERSION] = [ANGULAR MAJOR + ANGULAR MINOR]Example, with v1 of this repository with Angular 15.1.6:
v1.1501.0.0Feel free to make comments/suggestions to me in the Git issues section.


