I need serverside rendering for SEO in one of my apps. With the feature mention:
ssr: add @ionic/core/hydrate app in ionic 4.7 nitrogen I was very hopeful. I created a new tabs project and added Angular Universal like this:
ng add @nguniversal/express-engine --clientProject app
but when I try to run npm run build:ssr && npm run serve:ssr
I get window reference errors:
const win = window;
^
ReferenceError: window is not defined
ionic info:
Ionic:
Ionic CLI : 5.2.3 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.7.1
@angular-devkit/build-angular : 0.801.2
@angular-devkit/schematics : 8.1.2
@angular/cli : 8.1.2
@ionic/angular-toolkit : 2.0.0
Utility:
cordova-res : not installed
native-run : 0.2.7 (update available: 0.2.8)
System:
NodeJS : v10.13.0 (/usr/local/bin/node)
npm : 6.10.2
OS : macOS Mojave
Maybe Iām doing something wrong? Thanks!