Here is how i managed running ssr only on production:
angular.json
app.config.server.ts
main.server.ts
Angular 19.2