-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Allow build without es6 promise polyfill #11
Comments
@bitinn this is a great idea. I will see about tweaking the build to provide an option that excludes the polyfill. |
@mzabriskie this still causes problems in our project which imports axios indirectly, i.e. we import another library which imports axios. In our case we're building our project using webpack which is eventually importing axios, and naturally we haven't set up the A better approach might be to check if a native Promise implementation exists at runtime, because |
E.g. var es6Promise = require('es6-promise');
if (!global.Promise) {
es6Promise.polyfill();
} Although I'd question whether it's valuable for axios to be supplying the polyfill at all. It seems like it's useful exclusively for when the library's loaded in isolation - which won't happen in any more complex project with its own build system. In that case it might be better to include a bootstrapping file only for your Anyone that imports axios from source can be reasonably expected to have polyfilled their environment to include a Promise implementation. |
@wmadden the next release will remove the |
Great, thanks very much @mzabriskie! |
For webpack users looking for a way to polyfill Promises. Expose loader does the job nicely without requiring a boostrapped entry:
|
Great stuff! This seem to be the only lib I found that actually use native es6 promise with proper responseType for xhr2.
One suggestion: we actually manage polyfills separately, would be great to have a build without polyfill bundled to save some bytes.
The text was updated successfully, but these errors were encountered: