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

98
Visualizações
ES6 and values previously provided by the require object

In ES6 and later we prefer import over require.

In the absence of the require object, how does one access values historically presented as attributes of the require object? For example, require.main.filename

If there is a topic in the Node documentation dealing with this a reference would be greatly appreciated. In the meantime, I persist while Google fails to be my friend... obviously I'm asking the wrong question. Better search terms would also be helpful.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Accessing properties on the require function has been replaced by accessing the import.meta object in ES modules. It allows implementations to expose metadata about the module in a standard location.

Node.js in particular currently supports import.meta.url (like CommonJS __filename and __dirname) and import.meta.resolve (like require.resolve). The discussion about adding import.meta.main appears to have stalled.

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