Unexpected token on object spread
See original GitHub issueApologies if this is for the wrong project since I haven’t been able to do a direct 6to5 transform on the command line but this works in the 6to5 REPL.
In test.js:
var props = {a: 1, b: 2, c: 3};
var {a, ...other} = props;
I get the error
test.js:2 var { a, …other } = props; ^ ParseError: Unexpected token
Using the command browserify .\test.js -t [6to5ify --experimental --playground --whitelist es7.objectSpread] --outfile bundle.js
I’ve tried various combinations of the experimental, playground, and whitelist settings but to no avail.
Am I missing something?
Issue Analytics
- State:
- Created 9 years ago
- Comments:8
Top Results From Across the Web
spread operator in react throwing error of Unexpected token
i had installed eslint before, so I deleted it and installed transform-object-rest-spread again. I followed all the methods given in the link ...
Read more >Unexpected token ... ( spread operator ) #9675 - babel ...
Bug Report Babel can't recognize spread operator (..) return resolve(user && { ...user, domain }); i tried many solutions but without result ...
Read more >Error Following React Tutorial spread operator is ...
Error Following React Tutorial spread operator is unexpected token ... OK, the component looks OK, assuming the rest of the file is fine....
Read more >A few neat things you can do with the vanilla JS spread ...
The spread syntax operator (...) takes an array or object (or other iterable) and expands its items into their own individual values. let ......
Read more >Babel 6->7: Error unknown: Unexpected token (spread operator)
[Solved]-Babel 6->7: Error unknown: Unexpected token (spread operator)-Vue.js · npm cache clean --force · inside your main repo folder: rm -rf node_modules/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In case of useful, here’s a snippet from my build script:
I think what @oguzbilgic was referring to is this: http://babeljs.io/docs/usage/options/
Adding
stage-2
preset solved this problem for me. These links may be useful to others walking this path: https://babeljs.io/docs/plugins/ http://babeljs.io/docs/plugins/preset-stage-2/