Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

372
Views
NextJS Use 'importar' con paquetes ESM en su lugar

Estoy recibiendo este error:

 Module not found: ESM packages (remark) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals 2 | import path from 'path' 3 | //import matter from 'gray-matter' > 4 | import remark from 'remark' | ^ 5 | import html from 'remark-html'

Aunque el módulo se está importando correctamente.

Cuando lo cambio a un nombre que no existe, obtengo:

 ./lib/posts.js:4:28 Module not found: Can't resolve 'remarke' 2 | import path from 'path' 3 | //import matter from 'gray-matter' > 4 | import remark from 'remarke' | ^ 5 | import html from 'remark-html'

Entonces sé que es importado.

También intenté agregar esto a next.config.js:

 experimental: { esmExternals: "loose", },

Pero luego me sale este error:

 TypeError: (0 , _remark).default is not a function

Esto tiene algo que ver con el cambio al módulo ESM de la biblioteca de comentarios.

¿Alguien sabe qué puedo hacer para deshacerme de este error?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!