We’re having trouble starting a new Ionic 6 project with Angular 13 and server side rendering (SSR).
We’re following Mike Hartington’s Ionic blog post about SSR: Mike’s Post.
Does @ionic/angular-server support SSR with Angular 13? The package.json of that module makes me think it doesn’t.
Our Env Details
Angular CLI: 13.1.2
Package Manager: npm 8.1.2
OS: darwin arm64
… animations, common, compiler, compiler-cli, core, forms
… language-service, platform-browser, platform-browser-dynamic
… platform-server, router
When we follow the install steps and then run
npm run dev:ssr, we get this error:
We found a solution to this on Github: Ionic 5 SSR not working · Issue #4773 · ionic-team/ionic-cli · GitHub
Basically, we need to modify the angular.json to include ‘development’ entries.
The server will spin up and we can access localhost:4200. When we hit the page, it loads and doesn’t have any errors in the dev console. However, in our terminal, we get these errors:
IonicServerModule to the
app.server.module.ts imports, we re-run
npm run dev:ssr.
The build fails with these errors:
We haven’t be able to figure out a workaround beyond this point .
We were able to get ionic and angular SSR working by running this repo, but it’s using much older versions of angular, ionic, and ionic/angular-server. We’d like to avoid having to use older versions.
Any advice on getting this spun up in our environment?