Skip to content
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

Not working in IE11 #113

Closed
anibarro opened this issue Aug 20, 2020 · 6 comments
Closed

Not working in IE11 #113

anibarro opened this issue Aug 20, 2020 · 6 comments
Labels

Comments

@anibarro
Copy link

Hello,

The library is not working in IE11, https://janhommes.github.io/o.js/example/ fails with a "require is not defined" here:

const env = typeof window !== "undefined" ? window : global;
if (!("fetch" in env) && !config.disablePolyfill) {
   require("cross-fetch/polyfill");
}

Is the incompatibility intended? Thanks!

@janhommes janhommes added the bug label Aug 20, 2020
@janhommes
Copy link
Owner

looks like a bug to me:
https://unpkg.com/[email protected]/dist/umd/o.js

require calls should not be there. I guess we need to resolve the polyfills and inline them. The question is only if then the disablePolyfill setting makes any sense.

@anibarro
Copy link
Author

looks like a bug to me:
https://unpkg.com/[email protected]/dist/umd/o.js

require calls should not be there. I guess we need to resolve the polyfills and inline them. The question is only if then the disablePolyfill setting makes any sense.

Thanks for looking into this :)
In this case disabling them won't save any space... Including the polyfills is a nice touch, but I would personally let the user handle the polyfills if needed

@janhommes
Copy link
Owner

your suggestion is to don't inline any polyfills at all?

Mh, yeah might be a solution. The idea was basically (if I remember correctly) that the umd module is used by older browsers, which includes them by default. In the es2015 model (which is used by modern browsers) they are loaded only if needed. Wouldn't that make sense?

@anibarro
Copy link
Author

From what I can see in "caniuse.com", browsers compatible with ES6 also supports fetch and url, so it looks like polyfills won't be needed in the es2015.
I'm not sure what's the best solution, I couldn't make it work in IE11 even after transpiling the code with babel, I have to check that as well

@janhommes
Copy link
Owner

true, that's why there is the check for fetch and url to not load the polyfill if supported. Idea was that the umd module is slightly bigger, while esm can transpile it on their own and can decide if they want to use it. But I guess that is not gonna work that way :/

janhommes added a commit that referenced this issue Oct 22, 2020
@janhommes
Copy link
Owner

As discussed, the polyfills should now be excluded and the require call should not happen anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants