Using 'require' for module installed with npm

I’m building a Figma plugin and need to make a POST request to another API, so I installed the node package ‘node-fetch’ with npm i node-fetch, and am trying to bring it into my project with: const fetch = require(‘node-fetch’);

However, I’m getting “ReferenceError: ‘require’ is not defined”. How do I use require in this context? Thanks!

  1. Making Network Requests · Figma Developers

Also your post is in the wrong category, should be in #plugin-api:plugin-questions