Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
import 'unfetch/polyfill'; still has arrow functions that don't work in IE11 #101
Comments
|
My current guess is that you need to tell babel-loader (if you use webpack) to target es5 ? Edit: So I played around with webpack, included unfetch but then somehow babel-loader is not changing require(..) of the polyfill.mjs. Maybe it's something with .mjs? Anyway here is how I got it running, when you check the polyfill folder, there is a index.js in the polyfill folder for now: Changing:
|
|
Encountered this issue as well. I think the main problem is that many webpack configurations exclude Given that there is not yet consensus whether we should compile or not 3rd party library in |
|
still not working, Trying with ie11 and apollo-client as recommended by the packages. |
|
It works if you include I don't really know why it wouldn't compile the polyfill by default, though. I've set webpack to not exclude |
|
Ah, it's pointing to the src version of https://github.com/developit/unfetch/blob/master/polyfill/polyfill.mjs#L1 That line should instead be: import unfetch from '..'; |
|
regarding @ikevanc's other issue - the unpkg hotlinking worked, unfetch doesn't polyfill |
|
@developit I ran into this bug as well today and switching to "unfetch/polyfill/index" worked well as a workaround. Does your jan 15th comment about '..' mean that this is a bug that you intend to fix eventually? |
|
Yeah this tripped me up too – probably quite an important fix as this would be a pretty difficult bug for newcomers to identify and work around? |
|
Having to transpile unfetch to make it work in what is said to be a supported browser is definitely not expected behaviour to me :) I would prefer if node_modules was expected to be transpiled - that way the bundles would be really optimized. But that is not the reality today. Also, in order to transpile unfetch - don´t forget it uses .mjs files so you´ll need to do this in webpack/babel:
|
Working in TypeScript
Tried simple polyfill import, but it uses index.mjs that still has arrow functions.
Not sure how to get it working.
Tried <script src="/old?u=https%3A%2F%2Funpkg.com%2Funfetch%2Fpolyfill&y=1999"></script>
and it got over the =>, but then gave an error the Header was undefined.
Any suggestions?