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
./build.shnode dist/serverA 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)
App is served correctly
This works fine with Angular 6 and Angular CLI 1.7 but fails with Angular 6 and Angular CLI 6.
I saw a couple of other issues but they seem tied to 1.7 where 1.7 was working fine for me. https://github.com/angular/angular-cli/issues/8616
SSR is not working with CLI 6 you'll run into a StaticInjectorError, until they fix you you could downgrade the CLI (npm install @angular/[email protected] )
that is what I figured. just wanted to make sure there was a clear easy repro. 1.7 still works fine but bundles will be a bit bigger with rxjs6 and no webpack 4
@deebloo is it also about
--bundle-dependencies=all
Heya, I think this is a duplicate of https://github.com/angular/angular-cli/issues/8616, or at least the same root cause. It hasn't been addressed yet. I will bump it's priority.
cool deal thanks @filipesilva
Thank you so much @filipesilva let's hope it gets fixed soon.
I did solve this issue changing my webpack.server.config.js mode to development instead of production
Hope it helps
Angular CLI: 6.0.0
Node: 8.9.4
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.7.0
For me works just copy webpack.server.config.js from https://angular.io/guide/universal
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
I copy webpack.server.config.js from https://angular.io/guide/universal , Still have problems.
But I copy webpack.server.config.js from https://snipcart.com/blog/angular-seo-universal-server-side-rendering,fix this problems.
@HeMinzhang that configuration is working because it is forcing webpack's mode to none as opposed to production. This turns off minimization (the culprit), but it would also turns off EVERY other optimization for production.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
I did solve this issue changing my
webpack.server.config.jsmode todevelopmentinstead ofproductionHope it helps