Sep 02 2016 08:13 AM
I am using PnP-JS-Core from a simple SharePoint page to gather data from other webs.
using:
import { Web } from "sp-pnp-js/lib/sharepoint/rest/webs";
I am also using WebPack to bundle the solution but I'd like to use pnp.js from our internal CDN and not have everything bundled and create a big output.
I've setup webpack.config.js to not bundle "sp-pnp-js" but I cannot find a way to have that working for "sp-pnp-js/lib/sharepoint/rest/webs"
externals: {
// Do not bundle package PnP JS
"sp-pnp-js": "$pnp",
"sp-pnp-js/lib/sharepoint/rest/webs": ????
}
Any idea how to solve that ?
Oct 13 2016 01:01 PM
SolutionHello Djemel,
With the release of 1.0.5 this week we now support this scenario by exporting many of the objects to the root level. So if you do:
import { Web } from "sp-pnp-js";
let w = new Web("your full url");
w.get().then(...)
That should now be webpack friendly.