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

332
Vistas
Uncaught SyntaxError: Unexpected token ':' with Webpack + TypeScript + React Redux

I configured my simple webapp to build and run a WDS with TypeScript + React. It builds and shows the page properly.

Then, I am trying to add Redux and when I do a simple thing like importing useDispatch and trying to call it from my functional component, it builds but shows the error in browser console:

Uncaught SyntaxError: Unexpected token ':'

The code is:

import { useDispatch } from 'react-redux'

const MyView = () =>{
    const dispatch = useDispatch()
    ...
}

And the page shows nothing.

When I look into the source of the error, I see it's definitely not good because tries to access {...}.somValue which should be something like ({...}).somValue to not cause the error.

Syntax error

Is it something I can fix by changing webpack config? I only use ts-loader, without any babel stuff.

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

0

Seems like I had a wrong value in webpack config file, or at least removing it helped:

Was mode: "none"

I just removed the whole key and value and it worked.

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