Pnpjs: Documentation: sp\webs.html

Created on 17 Apr 2018  路  3Comments  路  Source: pnp/pnpjs

Please describe how we can improve the doc page:
import pnp from '@pnp/sp'; throws an error 'no default import'.
It should be changed to import * as pnp from '@pnp/sp';

The same for import { Web } from "@pnp/sp";
It should be like:

import * as pnp from '@pnp/sp';
//...
const web = new pnp.Web('https://contoso.sharepoint.com/sites/web');

Library version: 1.0.3

documentation fixed bug

All 3 comments

Thanks, we'll get this updated.

import { Web } from "@pnp/sp"; should work as there is an export "Web".

Yep, for Web it's my bad as I was trying do both in one line:

import pnp, { Web } from '@pnp/sp';

If you change the "pnp" to "sp" and move it inside the braces in your code you should be all set.

import { sp, Web } from "@pnp/sp"

Regardless, thanks for letting us know and we'll get the docs updated for the next release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simonagren picture simonagren  路  3Comments

ahsanranjha picture ahsanranjha  路  3Comments

SpliceVW picture SpliceVW  路  3Comments

un-dres picture un-dres  路  3Comments

KieranDaviesV picture KieranDaviesV  路  3Comments