SSR not working with ng
See original GitHub issueVersions
Angular CLI: 6.0.0
Node: 8.11.0
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
Repro steps
- clone repo: https://github.com/deebloo/ng6-ssr-error
- run
./build.sh
- run server:
node dist/server
- open app: localhost:4000
Observed behavior
A 500 errors occurs
TypeError: StaticInjectorError[InjectionToken Application Initializer -> InjectionToken DocumentToken]:
StaticInjectorError(Platform: core)[InjectionToken Application Initializer -> InjectionToken DocumentToken]:
Right-hand side of 'instanceof' is not an object
at bt (/Users/dannyblue/Documents/projects/foo/dist/server.js:1182:87380)
at gt (/Users/dannyblue/Documents/projects/foo/dist/server.js:1182:87255)
at ir (/Users/dannyblue/Documents/projects/foo/dist/server.js:1182:110026)
Desired behavior
App is served correctly
Mention any other details that might be useful (optional)
This works fine with Angular 6 and Angular CLI 1.7 but fails with Angular 6 and Angular CLI 6.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:21
- Comments:13 (4 by maintainers)
Top Results From Across the Web
SSR is not working on project build with angular 11
In my application, I fetching HTML data from the API and render it, but when I trying to do view the source after...
Read more >Server side rendering with universal · Issue #858 - GitHub
Please let us know about SSR work. I have this error: /node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.js:1 (function ( ...
Read more >Server-side rendering (SSR) with Angular Universal
This guide describes Angular Universal, a technology that renders Angular applications on the server. A normal Angular application executes in the browser, ...
Read more >How to build an Angular App with Server-Side Rendering
First run npm run build:ssr and when that is completed, run npm run serve:ssr . Your application should be served on localhost:4201. Transfer...
Read more >Angular Universal: Complete Practical Guide
This post will be a complete practical guide for getting started with Angular Universal. We are going to go start with an existing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I did solve this issue changing my
webpack.server.config.js
mode todevelopment
instead ofproduction
Hope it helps
Hey guys,
Similar to what @paulogr said, this error occurred for me when webpack minimizes the file (production mode). By turning minimization off, the 500 error no longer occurs.
My webpack config: https://gist.github.com/johnzondr/3d4a361ffcfe89f7ee5199dcc13bf246