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

207
Vistas
Trying to use "Socket.io-client" module in React throws error: Cannot assign to read only property 'exports' of object '#<Object>'

I'm using socket.io-client in my React js web app. It compiles without error, but when I try to open the development server (localhost:3000) I get the following error:

Error Screenshot

In this project where the error is being thrown, here is a list of the relevant packages and their versions:

  • @testing-library/jest-dom@5.14.1
  • @testing-library/react@11.2.7
  • @testing-library/user-event@12.8.3
  • react-dom@17.0.2
  • react-scripts@4.0.3
  • react@17.0.2
  • socket.io-client@4.3.1

Webpack Version: 4.44.2


Threads like this one suggest that this is some sort of issue with mixing import and module.exports in ES6, but I definitely don't want to modify the socket.io-client module.

In a previous React project, where the module works, here is a list of the relevant packages and their versions:

  • @testing-library/jest-dom@4.2.4
  • @testing-library/react@9.5.0
  • @testing-library/user-event@7.2.1
  • react-scripts@3.4.4
  • react@16.14.0
  • socket.io-client@4.1.2

Webpack Version: 4.42.0

I've played around a little bit with different versions of socket.io-client and react to try to get it working, but to no avail...

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

0

Webpack uses ES syntax, so commonJS syntax will not work.

export default lookup
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