Avoid import when targets support native `fetch`
See original GitHub issueWe can use this.project.targets
to determine if the whatg-fetch
polyfill is required for the browser builds, and avoid app.import
ing it when it is not needed.
See browser support. Roughly includes all evergreen browsers (FireFox, Edge, Chrome, Safari)…
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Trying to use fetch and pass in mode: no-cors - Stack Overflow
So I am trying to pass in an object, to my Fetch which will disable ... in practice the scenario that's for is...
Read more >Using fetch with TypeScript - Kent C. Dodds
When migrating some code to TypeScript, I ran into a few little hurdles I want to share with you. The use case: In...
Read more >Fetch Standard
The goal is to unify fetching across the web platform and provide consistent handling of everything that involves, including: URL schemes ...
Read more >API Docs | fetch-mock - Wheresrhys
fetch -mock allows mocking http requests made using fetch or a library imitating its api, such as node-fetch or fetch-ponyfill. It supports most...
Read more >Fetch API - MDN Web Docs
The Fetch API provides an interface for fetching resources (including across ... The following browsers shipped an outdated native fetch, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mydea - Yes, totally agreed.
@xg-wang - This issue was created to track avoiding the include the polyfill at all in
vendor.js
, but AFAICT the fix added in #63 will still continue to ship the polyfill but will avoid using it if native fetch is present. I’m reopening this issue so that we can track the vendor.js “slim down”…Released as v6.4.0 🎉
As mentioned in readme, to avoid bundling redundant polyfill assets just set
preferNative
totrue
Browser targets supports for
fetch
andabortcontroller
are checked from caniuse-api.ember-fetch
will then load only the necessary polyfills and its own wrapper 😄Thanks @mydea for landing this feature!