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

178
Views
Importing named export from a remote Javascript file in Node.js?

let's say I have some Javascript code living on a webserver that has this code:

export const runCommand = (args) => {

}

Now in my Node.js app, I'd like to some how download this remote file and import the runCommand function. I've tried looking into the VM Contexts however I was only successful at executing the code if it was called in that remote file.

In this situation, I would like to download the code, get the runCommand function, and then invoke it in my app whenever I want to. Is this possible?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

i am assuming you know the path to the remote command JS file you want to import. As such, I would reference this topic, and it should help with the URL-based file access:

ES6: import module from URL

if you don't know the path, then it's a different problem.

about 4 years ago · Juan Pablo Isaza Report
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!