TypeError: Object doesn't support property or method 'from' with PnPJS and Internet Explorer 11

Posted Monday, October 1, 2018 9:32 AM by CoreyRoth

You just built this amazing SPFx web part and it works great in modern browsers.  You then go to test (or even worse your users go to test) and you find that nothing works.  After examining your logs, you start finding the following error message.

TypeError: Object doesn't support property or method 'from'

What does that mean?  Basically, all of your calls to SharePoint made through PnPJS are failing.  You start to panic as you realize everything you built doesn't work in IE11.  Not to worry though, this can be fixed.  After doing some research, you might stumble upon this issue reported in GitHub.  The reason for this is that in version PnPJS 1.2.0, they dropped direct support for Internet Explorer.  That doesn't mean you are out of luck though and you need to go tell the client the solution you spent weeks on won't work for half their users.  You just need to add the right polyfills to your project and you are back in business.

Just add the following polyfills to the relevant part of your project.

import "core-js/modules/es6.promise"

import "core-js/modules/es6.array.iterator.js"

import "core-js/modules/es6.array.from.js"

import "whatwg-fetch"

import "es6-map/implement"

I find that if you are developing an SPFx web part, you can just add this to the web part's class (not the React component).  Add them anywhere near the top of that class and your IE users should be able to use your web part as intended.


No Comments

Leave a Comment