-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch breaks with update to 3.0.0 #656
Comments
I believe this also breaks IE10. Perhaps some transpiling is failing to occur? |
It appears this is also impacting JSDOM. No need to run IE11, you can reproduce the problem in a mocha test: // Imports
const fs = require('fs');
const assert = require('assert');
const { JSDOM } = require('jsdom');
// Setup
const window = new JSDOM('', { runScripts: 'outside-only' }).window;
const script = 'node_modules/whatwg-fetch/fetch.js';
window.eval(fs.readFileSync(script).toString());
// Specification Cases
describe('After loading "whatwg-fetch", the window object from JSDOM', () => {
it('has a fetch() function', () => {
assert.equal(typeof window.fetch, 'function');
});
}); With whatwg-fetch
With whatwg-fetch
|
Yes, The solution is to respect the |
How can this be used correctly via a CDN? |
With the new release, it looks like you need to pull the Here's one possible way: <script src=https://cdn.jsdelivr.net/npm/promise-polyfill@8.1/dist/polyfill.min.js></script>
<script src=https://cdn.jsdelivr.net/npm/whatwg-fetch@3.0/dist/fetch.umd.min.js></script> |
Sadly the SRI option doesn't seem to work there, but otherwise it works, thanks! |
Is |
To fix this, an easy solution would be to add a |
@rpellerin That would cause webpack to pickup the UMD package which is undesirable. |
@realityking I can't get it to work without the UMD package. It says something about no export found. |
This is a major problem as exports are not removed on standalone files served using CDN Update I'm thankful for OS and appreciate the hard work you do – but when a repo becomes the de facto standard more attention should be paid to how changes cascades – affecting thousand of users. From a quick test it looks as if removing the 5 export statements would make this CDN compatible again. Maybe consider making a local ES branch and keep the 'old' JS branch for CDN. |
The problem is still there, can anyone to fix this problem by removing the export and publish a CDN link. |
@jakob-e polyfill.io does not use github/fetch version 3. https://github.com/Financial-Times/polyfill-library/blob/master/package.json#L76 |
Could this be listed as a Breaking Change in the Release notes of 3.0.0? |
@jakob-e: We do not maintain CDNJS and we are not responsible for when it does wrong things. The problem with CDNJS is that it published support for fetch 3.0.0 without respecting the JSDelivr seems to be doing the right thing: https://www.jsdelivr.com/package/npm/whatwg-fetch @JesseDeBruijne What do you expect to be listed as a Breaking Change, exactly? For most intents and purposes, how this package behaves didn't change:
|
@mislav I'm aware, just asking you to be more careful with breaking changes that will cascade (automated scripts etc.). Also as mentioned it looks like you can simply remove the 5 export lines to make the current version 3 run on CDN too. |
@jakob-e For sure; if I knew how many cascading failures would the 3.0 release cause, I would have done this more carefully. 😣 However, I still don't believe that our team is responsible for actually fixing most of those failures. Too many people and scripts have hardcoded loading the
As for the CDN problem, here is what we (the maintainer team) don't have to do to fix it:
What CDNs should do to fix this:
I'm closing this now because there's not anything actionable for us to do to address the issues people have been having in this thread. If I have missed something, please let me know! |
If anyone is still using this package via bower... I'm not sure what the fix is? |
(Also this does seem an odd choice for a polyfill. Do any browsers actually exist that need a fetch polyfill and can do ES6? I don't understand what targets or use-cases an ES6 fetch polyfill is serving, but that just may be my lack of contemporary JS expertise. For me, not being an expert, it makes it somewhat more complicated to figure out how to properly deliver this polyfill to browsers that actually need it.) |
I don't get it.. what is the solution? We followed this: https://web.dev/codelab-serve-modern-code/ don't know if we updated this lib in the process also but it breaks even in chrome now We have this for IE11 (webpack.config.js):
and for modern browser supporting modules we don't even include this polyfill but seems like Chrome tries to load it anyway..
Is that not the way to load it? We use webpack 4 Edit: Also I see that we're still on "version": "2.0.4", but it broke after following above tutorial.. Tried updating to v3.0.0 but get the same issue |
|
Hmm seems the issue is that this file has BOM inside it... |
It seems, that after updating the build to rollup, the code is not transpiled correctly for IE11. We are recieving this error.
The fetch-polyfill.js includes the fetch.js file from your repository.
This is where it fails:
export function syntax is not supported in IE11
Version: 3.0.0
OS: Linux, Windows
Version 2.0.4 works fine for us.
The text was updated successfully, but these errors were encountered: