Morteza Ghelichkhani
Morteza Ghelichkhani

Reputation: 11

compiling Promises with babel and core-js causes infinite window reload

I want to run the following piece of code on IE11

let myPromise = Promise.resolve(123);
myPromise.then((value) => { 
console.log(value);
});

My recipe is Rollup and babel (& core-js for polyfilling) with the following .babelrc configuration:

{
    "presets": [
        ["@babel/preset-env", {
            "useBuiltIns": "usage",
            "corejs": 3,
            "targets": {
                "browsers": ["last 2 versions", "ie >= 11"]
            }
        }]
     ]
}

When I try to load the code, I get some infinite loop. The browser's tab seems to reload every couple of milliseconds.

Upvotes: 1

Views: 328

Answers (1)

Felipe Zuntini
Felipe Zuntini

Reputation: 21

I just wanted you to know that your question/issue in core-js (https://github.com/zloirock/core-js/issues/627) was really helpful and solved the problem for me, which was exactly the same as yours there and here.

So I wanted to leave here the solution provided there by Denis Pushkarev - as I did find this topic first and it may help other developers to quick get an answer:

You could change options to format: 'iife' to make it work.

Upvotes: 2

Related Questions