vue.js – ERROR in bundle.js from UglifyJs – SyntaxError: Unexpected token punc «(», expected punc «:»

by Thomas Beutel

I started playing with vue.js and used vue-cli to scaffold a new project. It all worked well until I tried npm run build. Then I got the following error:

ERROR in build.js from UglifyJs
SyntaxError: Unexpected token punc «(», expected punc «:» [build.js:8643,6]

It took me a while to find the answer, but I found it on Stackoverflow here:
http://stackoverflow.com/questions/41254538/error-in-bundle-js-from-uglifyjs

Basically I needed to create a .babelrc file as follows:

{
 "presets": [
  ["es2015", {"modules": false}]
 ]
}

That solved the problem for me, and the build is now successful.