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

311
Vistas
¿Cómo importar remark-gfm en next.config.js?

Quiero usar MDX en next.js y el complemento remark-gfm. Encontré Next.js Docs sobre MDX y sigo esto. y agregue la declaración de importación.

 // next.config.js import remarkGfm from 'remark-gfm;' const withMDX = require('@next/mdx')({ extension: /\.mdx?$/, options: { remarkPlugins: [remarkGfm], rehypePlugins: [] } }) module.exports = withTM( withMDX({ pageExtensions: ['js', 'jsx', 'md', 'mdx'], }) )

npm run dev y se produjo un error. SyntaxError: Cannot use import statement outside a module

Intenté cambiar import a require , pero ocurre otro error.

Error [ERR_ERQUIRE_ESM]: require() of ES Module /home/me/myblog/node_modules/remark-gfm/index.js from /home/me/myblog/next.config.js not supported.

¿Cómo puedo importar remark-gfm? ¿Es imposible?

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

0

Lo hice funcionar cambiando el nombre de archivo de next.config.js a next.config.mjs para admitir módulos ES.

Archivo: next.config.mjs

 import nextMdx from '@next/mdx'; import remarkGfm from 'remark-gfm;' const withMDX = nextMdx({ extension: /\.mdx?$/, options: { remarkPlugins: [remarkGfm], rehypePlugins: [] } }); const nextConfig = { reactStrictMode: true, pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], }; export default withMDX(nextConfig);
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