Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda