I cloned this reactjs/webpack2 repo:
https://github.com/ModusCreateOrg/budgeting-sample-app
which is working great , but I was playing around and chaned the index.js file with some properties/spread:
let myprops = [1,2];
let copyprops = {...myprops};
When I run npm start I get a build error:
Module build failed: SyntaxError: .../index.js:Unexpected token
It is referring to the line with the spread operator, how can I fix this? see also: repo
If you haven't changed the presets that are included in that repo then the spread operator won't work as you're noticing.
The spread operator is actually a part of the stage2 preset. You can find more info on that here https://github.com/babel/babel-loader/issues/170
So in order for your code to work you'll need to make sure you've both installed the babel-preset-stage-2
and set it as a preset in your .babelrc