2

I am learning React js+ Redux, I create a todo app which is followed:

http://redux.js.org/docs/basics/ExampleTodoList.html page's instruction.

After I run webpack, getting error:

ERROR in ./jsx/reducers/todos.jsx Module build failed: SyntaxError: Unexpected token (15:8)

enter image description here

Can anyone help me?

Mayank Shukla
  • 100,735
  • 18
  • 158
  • 142
rose
  • 21
  • 1
  • 4
  • Did you check this http://stefan.magnuson.co/articles/frontend/using-es7-spread-operator-with-webpack/ – Panther Aug 11 '17 at 10:03
  • Possible duplicate of [Browserify, Babel 6, Gulp - Unexpected token on spread operator](https://stackoverflow.com/questions/33745118/browserify-babel-6-gulp-unexpected-token-on-spread-operator) – Mayank Shukla Aug 11 '17 at 10:04
  • @Panther, thanks, after install babel-preset-stage-2, and add stage-2, it is working now – rose Aug 11 '17 at 12:40

1 Answers1

5

FYI, there's another topic open for that same issue.

Did you install the babel-preset-stage-0 ?

npm install --save-dev babel-preset-stage-0

Then you need to update your webpack.config.js by addind stage-0 to the presets:

presets: ['env','react','stage-0']

By the way, I'm learning redux too and I found this series of videos to make the concept of redux very simple and clear.

PS: I see you already found a solution in the comments of your post. FYI, stage-0 includes stage-2.

Evil Platypus
  • 374
  • 2
  • 6