Using fetch polyfill with Vue CLI 3 generated project

I have Vue CLI 3 generated project using the default settings.

I’d like to use the ky library for making HTTP requests from my app. ky is based on the browser Fetch API and supports only the latest versions of Chrome, Firefox, and Safari. To make it work with older versions, I need to transpile and use a fetch polyfill.

How do I implement the fetch polyfill in my Vue CLI generated app so I can use the ky library in older browsers too?

You just do what’s in the README:

import 'whatwg-fetch'
1 Like