I have made a Angular 6 project with dependency Angularfire2 .
I am using firestore and firebase storage.
I have converted my app to angular universal and when i run server.js
it says listening on localhost:4000
but as soon as i open the browser with localhost:4200
the terminal shows the following error:
ReferenceError: XMLHttpRequest is not defined
here is the snippet of the error
Install these dependencies:
npm install --save-dev ws xmlhttprequest
Then add this to your server.ts
file
(global as any).WebSocket = require('ws');
(global as any).XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
If you run into any other issue with SSR by using Firebase, check if this article already covers it.
Sources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With