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

217
Visualizações
Can I customize imports for binary files in javascript? Module not found error

First of all, thank you so much in advance if you are willing to help me out with this error! 👏

I have a Nextjs project and I have a jsconfig file with the following content in order to not use relative imports in the src code and it's working fine.

{
  "compilerOptions": {
    "baseUrl": "."
  }
}

So thanks to this file, I can use imports like lib/file-name.js instead of ../../lib/file-name.js in all of the files that are underneath the /src directory, which is a game changer!

But the issue comes when I want to execute some binary files (scripts for generating SEO files, etc...) that use some files that are in the /src folder and are using these custom/absolute imports.

The reason why these binary files are using files from the /src directory is that I have a custom API fetcher for example, that I use in both places (binary files to get data when executing those files, and at build time)

I tried to update the import in that binary file for a relative one and it works fine as you can see in the image below 👇

enter image description here

And the error I get is the following 👇

Error: Cannot find module 'lib/fetch-from-api'

- Is there a way to add an extra configuration for such binary files?

- How is this usually handled? Because I would not like the idea of having all the imports in the applications using relative imports

about 4 years ago · Santiago Gelvez
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