Import NPM packages into index.ts file

I am trying to create a Figma plugin that requires a scarping tool called Puppeteer. I tried installing the library and using it in the index.ts file by simply using const puppeteer = require(‘puppeteer’) but it doesn’t work. Is it possible for me to use puppeteer with figma plugins?

This is a Node (server-side) library, you cannot use it on the client side (in the browser).

Thanks for your reply, but I thought only the widgets are client-side?

Everything that is on your computer is client-side (computer/browser/Figma/plugin/widget is a client). (This is a simplification but accurate in this context.)

Cool thanks for the help :smiley: