Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

333
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda