Add PolyFill.js in AngularJS application

Deadly 提交于 2019-12-24 23:33:15

问题


WE are embedding PowerBi JavaScript SDK in angularJs App. PowerBI Javascript SDK makes use of the Promise.

IE 11 do not support Promises. Lot of posts directed me to make use of ployfill.js for the same.

My Question is how do I Inject PolyFill.js file in angularjs app?


回答1:


If you are using Webpack for bundling, add the polyfill.js before your main entry script.

module.exports = {
   entry: ['polyfill.js', './main.js']
};

If you are using script tags in html, make sure to include the script before any other library that uses promises (PowerBI):

<script src="path/to/polyfill.js"></script>

A more modular approach is to use core-js and include only the polyfill you need:

module.exports = {
   entry: ['core-js/fn/promise', './main.js']
};


来源:https://stackoverflow.com/questions/51491503/add-polyfill-js-in-angularjs-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!