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

201
Vistas
Next.js HMR doesn't work when external react and react-dom

I have an application which required window.React and window.ReactDOM, so i modify the webpack externals field in next.config.js like this:

// next.config.js
/** @type {import('next').NextConfig} */
module.exports = {
  reactStrictMode: true,
  webpack(config, { isServer }) {
    if (!isServer) {
      config.externals = {
        next: 'next',
        react: 'React',
        'react-dom': 'ReactDOM'
      }
    }
    return config;
  }
}

But when i do this, the page can't hot reload when editing code. And there is no warning or error in the Chrome console panel. Only when i manually refresh the page, the latest code can work as well.

Reproduce repositry: https://github.com/MrKou47/nextjs-hmr-notwork-demo

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