How to get Ionic Angular SSR to work in new project?

Hello all does ionic provide an updated tutorial on how to add @angular/ssr to a new ionic project?

I Found several links online that help do this but it’s outdated and do not work.

Both of these tutorials are using Modules but my project is using standalone components. but it should still work as i can import the IonicServerModule in the app.component.ts file. So as i did and run : npm run dev:ssr that i get an error in the console:

After searching i found this in this closed issue in the ionic repo that is related to my problem:

Ionic Dev states:

This ended up being a Stencil bug that we fixed in v4.8.0 of Stencil and was resolved as a result of this commit: 34417a5 that shipped in v7.5.8.

My project is running ionic 7.7.0 but its still showing the error. Has anyone figured out how to get Angular SSR to properly run with no errors?

Here is my dependencises in package.json file:

"dependencies": {
    "@angular/animations": "^17.2.1",
    "@angular/common": "^17.2.1",
    "@angular/compiler": "^17.2.1",
    "@angular/core": "^17.2.1",
    "@angular/forms": "^17.2.1",
    "@angular/platform-browser": "^17.2.1",
    "@angular/platform-browser-dynamic": "^17.2.1",
    "@angular/platform-server": "^17.2.1",
    "@angular/router": "^17.2.1",
    "@angular/service-worker": "^17.2.1",
    "@angular/ssr": "^17.2.0",
    "@capacitor/app": "5.0.7",
    "@capacitor/core": "5.7.0",
    "@capacitor/haptics": "5.0.7",
    "@capacitor/keyboard": "5.0.8",
    "@capacitor/status-bar": "5.0.7",
    "@ionic/angular": "^7.7.2",
    "@ionic/angular-server": "^7.7.2",
    "express": "^4.18.2",
    "ionicons": "^7.2.2",
    "rxjs": "~7.8.1",
    "tslib": "^2.6.2",
    "zone.js": "~0.14.4"
  },

EDIT: just created a new ionic project not using standalone and it still does not work.

You can create a reproducible demo by just creating new project in ionic cli and adding the @angular/ssr package, adding the IonicServerModule to your AppComponent file and running: npm run dev:ssr.

I created a new project using angular cli and added ionic lib to that project. I added @angular/ssr. When running: npm run build:ssr. I get the following as this seems to be pointing towards stencil.:

When i run: npm run serve:ssr:ng-ssr-demo: it shows the app and i can inspect to view page source and i can see its running SSR.

Im not sure what the hell is going on…

I am still having this problem with angular 17 and ionic 7.7.4