Skip to main content
Question

Using 'require' for module installed with npm

  • March 19, 2022
  • 1 reply
  • 2095 views

Kasyap_Chakravadhanula

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 reply

Gleb
  • Power Member
  • 4706 replies
  • March 19, 2022
  1. Making Network Requests | Plugin API

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings