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

234
Vistas
Next.js imports from root directory: is it valid to start an import with a slash?

This import works, but I can't find any documentation saying that it's valid:

// rather than do a crazy nested import like this
import { myUtil } from '../../../../../lib/utils'

// this appears to work just fine
import { myUtil } from '/lib/utils'

I see where the official answer is to set up a config file with a @ alias, so I suppose I will just do that to be compliant. Just thought it was curious that this import worked just fine. I am using the default configuration for a Next.js project set up with create-next-app

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Not sure if this is your case, but if the top folder is in the root directory, you can use this

import { myUtil } from './lib/utils'

I'm guessing that's what's happening, even though you don't have the period in yours.

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