PnP JSCore 2.0.2


The latest release, 2.0.2, of the Patterns and Practices JavaScript Core Library represents an incremental update which contains fixes and updates of reported issues since the last release. Thanks to everyone who has provided valuable feedback and helped the library grow.

Revert to es5 in lib Folder

After we had a number of issues reported that were all related to distributing es6 modules in the sp-pnp-js npm package’s lib folder we are reverting back to es5 for distribution. We have maintained since the beginning we want to remove obstacles to using the library. In this case after hearing from folks it was an obvious choice.

One thing interesting point to consider is that the rollback is driven almost entirely by the wide usage of uglifyjs across the web development community. Because we (collectively all of us) have taken a dependency on uglifyjs and it cannot handle es6 modules the de facto module standard is es5. And this is not to point at uglifyjs in a bad way, they have done amazing work – as shown by the high usage, but rather it highlights the dependencies that aren’t always immediately obvious in open source development.

But at the end of the day anything that makes it harder to use sp-pnp-js should be addressed and this is one of those cases. So all the issues folks were reporting around uglifyjs or –ship, etc should now be fixed. This also has the added benefit of helping out folks supporting IE 10 & 11 as well. The guidance on using the library with SPFx is updated as well.

Optimization for contextinfo Calls

An issue was reported where it was found we weren’t effectively caching the contextinfo and then repeating calls unnecessarily within the same site. Great find and a good fix so you should see a reduction in traffic when using the library.

Support for Ambient Typings

It was reported twice in the last month that folks were trying to use the library in an ambient way (i.e. as if imported via a global script tag) and needed support for the typings. To enable this we added a shim file and usage is shown below. There is also a new wiki page with details of this approach as well.

Updated to Webpack 2

We also took some time to update our build pipeline to use webpack 2. This should be invisible to folks but worth mentioning. The update process was very easy and they have a great guide to follow when migrating from 1.*.

Developer Guide

Be sure to check out the developer guide, we are working to add new articles and update existing ones based on feedback. This is a great place if you are just getting started with the library.

Fixes & Updates

This was a bug fix heavy release as opposed to new features, so wanted to call out those fixes in case you have seen similar issues.

  • Fixed issue with adding items and batching
  • Addressed issue with TypeScript 2.2.1
  • Fixed an issue with JSDoc where the information in articles was being duplicated
  • Updated release guide to remember to do git releases to support bower as reported in two issues
  • Fixed an issue where errors on list item update were being hidden and not properly thrown to a subscribed catch
  • Fixed an issue with updating list items in a batch were the dependency was not being resolved and the update hung
  • Added the as function to Queryable – part of the upcoming extensibility story
  • Exporting the Queryable base classes – part of the upcoming extensibility story

Thanks again to everyone that provided feedback on the library this month, it drove some great updates and fixes! Let’s keep the dialog going.

What is the JS Core Component?

The Patterns and Practices JavaScript Core Library was created to help developers by simplifying common operations within SharePoint and the SharePoint Framework. Currently it contains a fluent API for working with the full SharePoint REST API as well as utility and helper functions. This takes the guess work out of creating REST requests, letting developers focus on the what and less on the how.

“Sharing is Caring”


Comments (0)

Skip to main content