Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

328
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!