npm i -S whatwg-fetch
- At top of your main file (e.g.
main.ts
) addimport 'whatwg-fetch';
- If you're using typescript:
typings install dt~whatwg-fetch --global
(you may need a different command depending on your versions) - Modify your
aurelia_project/aurelia.json
and put the following into the pathbuild.bundles[1].dependencies
(you'll see where all the other deps are)
"aurelia-fetch-client",
{
"name": "whatwg-fetch",
"path": "../node_modules/whatwg-fetch/fetch"
},
- You'll likely get a complaint about URLSearchParams when you
au run --watch
. To fix, add a custom typings file atcustom_typings/whatwg-fetch.extension.d.ts
(name it anything *.d.ts) and add:
interface URLSearchParams {}
Errors will still be spat out, sometimes a lot, sometimes only few, but won't break the run.