kartsims / vue-customelement-bundler

How to bundle a Vue.js components in a single JS file, to be used in any HTML/JS app
http://vuetips.com/vue-web-components
126 stars 20 forks source link

Error in rollup.js while running npm run dev #4

Closed gijo-varghese closed 6 years ago

gijo-varghese commented 7 years ago

I'm getting the following error when I run : npm run dev

ERROR in my-vue-component.js from UglifyJs
Unexpected token: punc (() [my-vue-component.js:9928,9]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! vue-customelement-bundler@1.0.0 build: `rimraf dist && cross-env NODE_ENV=production webpack`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the vue-customelement-bundler@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gijo/.npm/_logs/2017-09-26T06_40_33_955Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! vue-customelement-bundler@1.0.0 postinstall: `npm run build`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the vue-customelement-bundler@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gijo/.npm/_logs/2017-09-26T06_40_33_969Z-debug.log
kartsims commented 7 years ago

I don't know much about Rollup sorry, let's ask @chimon2000 who contributed to this branch

lumine commented 6 years ago

This happened to me on the webpack build ERROR in my-vue-component.js from UglifyJs Unexpected token: punc (() UglifyJs did not seem to understand the ES2015 Enhanced Object Literal syntax. The second line where a method is declared. methods: { share ($event) { window.alert('Share on ' + $event.target.innerHTML); } I have node 8 and npm 5.5.1 I don't understand Babel well enough to figure it out yet. Maybe it needs a .babelrc file or an update to babel-preset-env.

ryangiordano commented 6 years ago

I fixed this by adding a .babelrc file with the following content: { "presets": [ ["es2015", {"modules": false}] ] }

This was with the webpack build.

kartsims commented 6 years ago

would you please send a PR ?

kartsims commented 6 years ago

Just merged this commit to master and added .babelrc to branch rollup