This problem also occurs in angular universal
:
I try to install node-fetch-polyfill
and import it.
//npm install node-fetch-polyfill
import * as fetch from "node-fetch-polyfill";
ngOnInit() {
if (typeof fetch !== 'function') {
(global as any).fetch = fetch;
}
}
But it still doesn't work, I don't use fetch
directly in my code.