File tree Expand file tree Collapse file tree 6 files changed +43
-9
lines changed
templates/components/angular Expand file tree Collapse file tree 6 files changed +43
-9
lines changed Original file line number Diff line number Diff line change @@ -85,12 +85,27 @@ if [[ "$FRAMEWORK" == 'angular' ]]; then
8585 USE_STANDALONE=" false"
8686 fi
8787
88+ # Check if Angular 21+ for zone.js and app.config support
89+ if [[ " $FRAMEWORK_VERSION " == " latest" || " $FRAMEWORK_VERSION " -ge 21 ]]; then
90+ USE_V21_CONFIG=" true"
91+ else
92+ USE_V21_CONFIG=" false"
93+ fi
94+
8895 if [[ " $USE_STANDALONE " == " true" ]]; then
8996 echo " cp templates/components/angular/app-standalone.component.ts mega-apps/${MEGA_APP_NAME} /src/app/app.component.ts"
9097 cp templates/components/angular/app-standalone.component.ts mega-apps/${MEGA_APP_NAME} /src/app/app.component.ts
9198
92- echo " cp templates/components/angular/main-standalone.ts mega-apps/${MEGA_APP_NAME} /src/main.ts"
93- cp templates/components/angular/main-standalone.ts mega-apps/${MEGA_APP_NAME} /src/main.ts
99+ if [[ " $USE_V21_CONFIG " == " true" ]]; then
100+ echo " cp templates/components/angular/main-standalone-v21.ts mega-apps/${MEGA_APP_NAME} /src/main.ts"
101+ cp templates/components/angular/main-standalone-v21.ts mega-apps/${MEGA_APP_NAME} /src/main.ts
102+
103+ echo " cp templates/components/angular/app.config.ts mega-apps/${MEGA_APP_NAME} /src/app/app.config.ts"
104+ cp templates/components/angular/app.config.ts mega-apps/${MEGA_APP_NAME} /src/app/app.config.ts
105+ else
106+ echo " cp templates/components/angular/main-standalone.ts mega-apps/${MEGA_APP_NAME} /src/main.ts"
107+ cp templates/components/angular/main-standalone.ts mega-apps/${MEGA_APP_NAME} /src/main.ts
108+ fi
94109
95110 if [ -f " mega-apps/${MEGA_APP_NAME} /src/app/app.module.ts" ]; then
96111 echo " rm mega-apps/${MEGA_APP_NAME} /src/app/app.module.ts"
Original file line number Diff line number Diff line change @@ -95,6 +95,12 @@ elif [ "$FRAMEWORK" == 'angular' ]; then
9595 # remove angular since it's deprecated https://www.npmjs.com/package/angular
9696 # We've install @amplify/cli when creating the app
9797 DEPENDENCIES=" $TAGGED_UI_FRAMEWORK aws-amplify"
98+
99+ # Angular 21+ requires zone.js to be explicitly installed
100+ if [[ " $FRAMEWORK_VERSION " == " latest" || " $FRAMEWORK_VERSION " -ge 21 ]]; then
101+ DEPENDENCIES=" $DEPENDENCIES zone.js"
102+ fi
103+
98104 echo " DEPENDENCIES=$DEPENDENCIES "
99105fi
100106
Original file line number Diff line number Diff line change @@ -82,13 +82,6 @@ echo "##################"
8282echo " # Setup Mega App #"
8383echo " ##################"
8484
85- # Override Angular latest to v20 until v21 compatibility is resolved
86- if [ " $FRAMEWORK " == " angular" ] && [ " $BUILD_TOOL " == " angular-cli" ] && [ " $FRAMEWORK_VERSION " == " latest" ] && [ " $BUILD_TOOL_VERSION " == " latest" ]; then
87- FRAMEWORK_VERSION=" 20"
88- BUILD_TOOL_VERSION=" 20"
89- echo " Overriding Angular latest to v20 to bypass compatibility issues with v21+"
90- fi
91-
9285BASE_OPTIONS=" --build-tool $BUILD_TOOL --name $MEGA_APP_NAME --framework $FRAMEWORK --framework-version $FRAMEWORK_VERSION "
9386
9487# Create mega app
Original file line number Diff line number Diff line change 1+ import { ApplicationConfig , provideZoneChangeDetection } from '@angular/core' ;
2+ import { provideRouter } from '@angular/router' ;
3+
4+ import { routes } from './app.routes' ;
5+
6+ export const appConfig : ApplicationConfig = {
7+ providers : [
8+ provideZoneChangeDetection ( { eventCoalescing : true } ) ,
9+ provideRouter ( routes ) ,
10+ ] ,
11+ } ;
Original file line number Diff line number Diff line change 1+ import { bootstrapApplication } from '@angular/platform-browser' ;
2+ import { AppComponent } from './app/app.component' ;
3+ import { appConfig } from './app/app.config' ;
4+
5+ bootstrapApplication ( AppComponent , appConfig ) . catch ( ( err ) =>
6+ console . error ( err )
7+ ) ;
Original file line number Diff line number Diff line change 1+ import 'zone.js' ;
2+
13( window as any ) . global = window ;
24( window as any ) . process = {
35 env : { DEBUG : undefined } ,
You can’t perform that action at this time.
0 commit comments