From 7cd87d3b6449bb7b5c3f859315b6b8cc96be08f9 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Thu, 30 Mar 2017 09:05:12 +0300 Subject: [PATCH] #316: fix fetch on Edge --- src/polyfills.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/polyfills.js b/src/polyfills.js index cdadd64..a7d9aa2 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -1,7 +1,18 @@ import 'babel-polyfill'; -import 'whatwg-fetch'; import { shim as shimPromiseFinaly } from 'promise.prototype.finally'; +const isEdge = /Edge\//.test(navigator.userAgent); +if (isEdge) { + // Edge has a broken fetch implementation, so forcing the polyfill + // https://www.reddit.com/r/webdev/comments/57ii4f/psa_edge_14_ships_a_broken_windowfetch/ + // https://github.com/aurelia/fetch-client/issues/81 + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/9370062/ + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7773267/ + window.fetch = undefined; +} + +import 'whatwg-fetch'; + shimPromiseFinaly(); // allow :active styles in mobile Safary