0

Attempting to implement server side rendering using Angular Universal for an Angular 6 app. Tried all the tutorials I could find, but could only get @ng-toolkit/universal to serve the app. When I view the page source, it does not show a server side rendered app, it looks just like the normal angular app.

Are there extra steps I need to take with @ng-toolkit/universal to achieve server side rendering with angular universal? The app is set up as a PWA as well.

UPDATE: The main reason for using ng-toolkit was the DOM Window mock class. This app uses MDBootstrap which has a transitive dependency on HammerJS. When attempting to run server side, I get the 'window is not defined' error for HammerJs.

Bill Bensing
  • 193
  • 2
  • 17

2 Answers2

0

You have to build for production before ng-toolkit changes will be visible in browser:

npm run build:server:prod

followed by

npm run server

*Note: "ng build --prod" throws an error on "npm run server" currently

Joe Code
  • 21
  • 4
0

I had this problem and I just solve it. you can find my answer here:

https://stackoverflow.com/a/59296224/8041124

Max Hesari
  • 631
  • 6
  • 10