Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda