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

374
Vistas
Imports from public folder Nextjs in typescript give error: Cannot find module

I am trying to import files using regular import and with the custom absolute paths in Nextjs using typescript. For some reason I keep getting an error that the module cannot be found but my IDE is able to link the file when I click on it. Also, when its a regular javascript file, instead of typescript, it works fine and files are imported.

For now im using // @ts-ignore and it works, but I wonder if there is a better way to solve this error.

My tsconfig:

    {
  "compilerOptions": {
    "target": "es2015",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/components/*"],
      "#/*": ["public/assets/images/*"],
    }
  },
  "include": [
    "public/**/*",
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try changing the path of the import.

If you have a baseUrl of “.”, the path would be ...from '/public/...'. instead of ...from './public/...'

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