Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

PNP JS Error Fixed – IE 11 Polyfill

Recently I came across the below errors running the PNP JS library with IE11.   The library leverages newer ES6 JavaScript concepts and IE 11 has an older JavaScript runtime engine.

To resolve that, we need to reference more JS libraries as “polyfill” (sometimes called “shim”) to close the gap.

After extra JS files are referenced you can continue using PNP JS normally.  As far as I can tell, there is no negative impact to other browsers by adding these JS polyfills.   Cheers! 

shades_smile

Download JS Polyfill

Code

<!– IE 11 Polyfill – https://github.com/SharePoint/PnP-JS-Core/wiki/Install-and-Use#polyfill –>
<script src=”/sites/team/SiteAssets/myApp/node_modules/bluebird/bluebird.min.js”></script>
<script src=”/sites/team/SiteAssets/myApp/node_modules/es6-promise.min.js”></script>
<script src=”/sites/team/SiteAssets/myApp/node_modules/fetch.js”></script>

IE Errors

  • ReferenceError: ‘Promise’ is undefined (sp-pnp-js/dist/pnp.min.js:1:3661)
  • Unhandled rejection ReferenceError: ‘Headers’ is undefined

Screenshots

SNAGHTML4e27a40

References

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲