Comments (11)
This syntax works for me:
/// <reference path="pnp.d.ts" />
import PnP = require("pnp");
The first line gives the ref to the typings file and the second is the actual "import" into your code. Please confirm and we can close the issue.
from pnp-js-core.
Thanks Patrick, will try and report back.
from pnp-js-core.
So it looks to me that we would have to produce a set of es6 *.js files in the lib package and then have a separate build path for the pnp.js file that produces UMD. I guess I'll take a look at this one, which puts samples on the back burner unfortunately.
from pnp-js-core.
Cool thanks @patrick-rodgers. Sounds like that might handle the es6 side of things. We'll see how it goes.
Maybe related questions:
-
I could be wrong and old school, but doesn't the
import PnP = require("pnp");
syntax requires a (typing and runtime) dependency on requirejs? I thought we didn't have any dependencies (at runtime) other than things that SharePoint itself provides on a SharePoint page? -
Also shouldn't the naming of the alias in something like:
import {$pnp} = from 'whateverwenameit';
be $pnp so it can be used in all TypeScript documentation/samples since that's what is the global name ends up being in JavaScript? Reason being: it make samples and documentation much easier to write for both TypeScript and JavaScript because the same $pnp entity can be referenced from whatever way you are including it. Otherwise, the JavaScript and TypeScript samples and documentation will deviate radically with different "root variables" (PnP, $pnp). Thoughts?
from pnp-js-core.
- Updated in #75, now supports:
import pnp from "sp-pnp-js";
Please validated with latest npm package 0.0.10.
- You can name it whatever you want when you import.
from pnp-js-core.
@patrick-rodgers New package is not working in jspm (and I suspect npm as well since jspm is simply downloading the npm package).
Here is the top of pnp.js that was downloaded from the 0.10 (confirmed in package.json) npm package.
It doesn't look like it got transpiled to ES5
/* */
"format cjs";
"use strict";
import * as Util from "./utils/Util";
import { SharePoint } from "./SharePoint/SharePoint";
import { PnPClientStorage } from "./utils/Storage";
import * as Configuration from "./configuration/configuration";
import { Logger } from "./utils/logging";
import { Rest } from "./SharePoint/Rest/rest";
from pnp-js-core.
Forgot to mention, Intellisense was working out of the box this time though.
from pnp-js-core.
The code in /lib is es6 to support the es6 syntax. The code in the dist folder is es5 in a umd module and should be used in the browser.
from pnp-js-core.
package updated to maintain the default export we desire for umd modules in the browser in #80. @alex-randall please test, would like to get this one closed.
from pnp-js-core.
Hi,
I just want to say that I test the library in ASP.Net application:
///<reference path="../node_modules/sp-pnp-js/dist/pnp.d.ts"/>
import * as Pnp from "pnp";
works,
///<reference path="../node_modules/sp-pnp-js/dist/pnp.d.ts"/>
import Pnp = require("pnp");
works also.
I have tested it also in Nodejs typescript application and it works the same way.
Dev env: Visual Studio 2015 Enterprise Update 2
Would be great if somebody else confirm the results.
from pnp-js-core.
This appears to be fixed, thanks all.
from pnp-js-core.
Related Issues (20)
- return type for getAll HOT 2
- Handling HTTP 400 Errors via catch HOT 2
- Qustion: The field 'xxxx' is not supported in query. The lookup list is in another web. HOT 1
- [Question]: Retrieve all files within a document library HOT 2
- multiple delete does not work with String Array! HOT 3
- Sharing Site collection to an external user HOT 1
- Uploading package to app catalog HOT 4
- Is it possible to fetch data from client side modern page and show it into a new page SPFX HOT 2
- A call to contextInfo is being made by each spfx webpart. HOT 1
- When I try to upload large file on SharePoint 2013 On-Premise it gives error Resource not found HOT 1
- UserProfile MyProperties with error 500 HOT 2
- Cannot get FileRef from getItemsByCAMLQuery method HOT 1
- how to add field to view? HOT 2
- Trying to update sharepoint library metadata column using pnp js HOT 1
- IncludeGroupsSites doesnt work in the sp.social.my.followed(SocialActorTypes.IncludeGroupsSites) HOT 1
- Using Angular@6 util.js error HOT 3
- Having issues adding User and Lookup fields to List HOT 2
- How to get specific version of item? HOT 3
- Ability to view/add/remove Site Collection Admins? HOT 2
- SPFX and AD Groups Permissions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pnp-js-core.