0

I was importing one of the polyfill, "es6-promise" in my jsx file of react application but was not able to import it in a correct way.

I googled N number of solution finally one worked for IE. require('es6-promise').polyfill()

its working fine but, why it was not working for import es6-promise from "es6-promise"; Is there any way to import it first in a variable and then calling the .polyfill() method to that variable?

2 Answers 2

1

There a multiple ways of how you can import other modules in your code: import

For example:

import * as ES6Promise from 'es6-promise';

ES6Promise.polyfill();
Sign up to request clarification or add additional context in comments.

Comments

0

Just a couple more ways you can do it.

import { polyfill } from 'es6-promise';
polyfill();

or

import ES6Promise from 'es6-promise';
ES6Promise.polyfill();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.