All Apps and Add-ons

How can I use third party npm packages in Splunk app?

mohsenvafa
Engager

I am creating an app using Splunk Web splunk app. I need to install a third party library from npm package manager by npm install command.
Where and how I can install the package?

To be specific, I want to install puppeteer package and use it in my js file.

https://www.npmjs.com/package/puppeteer

here is my code:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');

  // Get the "viewport" of the page, as reported by the page.
  const dimensions = await page.evaluate(() => {
    return {
      width: document.documentElement.clientWidth,
      height: document.documentElement.clientHeight,
      deviceScaleFactor: window.devicePixelRatio
    };
  });

  console.log('Dimensions:', dimensions);

  await browser.close();
})();
0 Karma

dkeck
Influencer
0 Karma

mohsenvafa
Engager

I don't think it is the solution. The library I am going to use is a npm package. In that article, it has not mentioned anything about this kind libray.

0 Karma

dkeck
Influencer

If it was helpfull please accept the answer, thank you

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...