Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

363
Views
require () del módulo ES no compatible

Estoy usando el siguiente código en VS. (Me referí a este artículo https://www.agrenpoint.com/azurefunction-v2-pnpjs/ )

Pero dice que no se admite require() del módulo ES.

Cómo resolver este problema ??

 // equal to: import { sp } from "@pnp/sp;" const sp = require("@pnp/sp").sp; // equal to: import { SPFetchClient } from "@pnp/nodejs;" const SPFetchClient = require("@pnp/nodejs").SPFetchClient; module.exports = async function (context, req) { context.log('JavaScript HTTP trigger function processed a request.'); if (req.query.site || (req.body && req.body.site)) { const siteName = req.query.site || req.body.site; sp.setup({ sp: { fetchClientFactory: () => { return new SPFetchClient( `${process.env.spTenantUrl}/sites/${siteName}/`, process.env.spId, process.env.spSecret); }, }, }); // Get the web and all the Lists const web = await sp.web.select("Title").expand('Lists').get(); context.res = { // status: 200, /* Defaults to 200 */ body: "All of the lists in the site " + web.Title + ": " + web.Lists.map(list => list.Title).join(', ') }; } else { context.res = { status: 400, body: "Please pass a site on the query string or in the request body" }; } };
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!