ysmood / yaku

A lightweight promise library
https://tonicdev.com/ysmood/yaku
MIT License
290 stars 28 forks source link

Does not work on UC Browser #45

Closed JoyceBabu closed 7 years ago

JoyceBabu commented 7 years ago

The following code is not working in UC Browser, because this is undefined inside an IIFE in UC Browser.

function(module, exports, __webpack_require__) {

    /* WEBPACK VAR INJECTION */(function(global) {var Yaku = __webpack_require__(/*! ./yaku */ 80);

    try {
        global.Promise = Yaku;
        window.Promise = Yaku;
    } catch (err) {
        null;
    }
    /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))

/***/ }
ysmood commented 7 years ago

I think this may be a bug of webpack, not Yaku?

JoyceBabu commented 7 years ago

@ysmood I believe it is actually a bug with UC Browser, as all other browsers are working correctly.

I have opened an issue with webpack https://github.com/webpack/webpack/issues/4743

Since Yaku is bundled as the default polyfill in polyfill.io, the service is currently broken for UC Browser users. According to StatsCounter, UC Browser has a global browser market share of 8.75%. According to some reports, in India it is as high as 50%. 28% of our traffic is from UC Browser.

Until it is fixed in webpack, can you please add a work around? (global||{}).Promise would look ugly, but would greatly increase the browser compability of the polyfill.

ysmood commented 7 years ago

(global||{}).Promise added, and new version was published, good luck.

JoyceBabu commented 7 years ago

Thank you. It is now working on UC Browser.

JoyceBabu commented 7 years ago

I tried with building the polyfill with webpack 2, as per advice at https://github.com/webpack/webpack/issues/4743

The issue is fixed and no longer required with Webpack 2.

I would like to create a PR to https://github.com/Financial-Times/polyfill-service for updating the polyfill. Do you plan to upgrade to webpack 2 or continue with the temporary fix? Should I wait or go ahead and create the PR?

ysmood commented 7 years ago

Thanks for your feedback.

JoyceBabu commented 7 years ago

@ysmood Do you have plans to update to WebPack 2? If not, shall I create the PR for https://github.com/Financial-Times/polyfill-service?

ysmood commented 7 years ago

851df7fed59795110ff1890cfefb9e50f9d78633

Updated and new version published.

If you have any problem, please let me know.

JoyceBabu commented 7 years ago

The updated plugin is working correctly on UC Browser. Thank you.