fetch not defined in Safari (ReferenceError: Can't find variable: fetch)

前端 未结 2 1965
无人及你
无人及你 2021-02-01 05:03

For some reason fetch (https://fetch.spec.whatwg.org/) is not defined in Safari (Version 9.0.3), does anyone know why? It seems to be the standard and works fine in

2条回答
  •  粉色の甜心
    2021-02-01 05:51

    Use whatwg-fetch polyfill. If you use webpack, you could just add it to entry point

    entry: {
      app: ['whatwg-fetch', 'your-index.js']
    }
    

提交回复
热议问题