Recommended Way To Include Babel Polyfill?

Recommended Way To Include Babel Polyfill?


anyone knows what is the best way to include babel polyfill or shims like es5-shims or similar? i have done a

import "@babel/polyfill"

in the first file that IE11 complained about and it works, however, it seems kind of hackish.

i’ve also read some topics from a while that cocos dev team was planning on bundling babel polyfill, but i can’t seem to find it any more info on this. is there some sort of a hidden setup to activate it?


I don’t know what babel polyfill is.
But you can use npm packages in your project.

Did you try to install this package?
npm install --save @babel/polyfill


Yes, the babel npm package has been installed, other wise importing it would result in a compilation error :grinning:

to be more precise, i want to make sure it’s included only once and before everything else, that’s because cocos engine js also needs to be polyfilled for IE11 (e.g. usage of Symbol).

i would like to import/require in the CC “entry point” ts/js file, however, i have no idea what that is. would the generated main.js be considered as such?