vue-snotify icon indicating copy to clipboard operation
vue-snotify copied to clipboard

Unexpected token: name (code)

Open wmcmurray opened this issue 7 years ago • 4 comments

I'm unable to compile my project with webpack because an error is thrown by UglifyJS : Unexpected token: name (code). Its because my project does not use babel or ES6 syntax, but there is ES6 syntax in the compiled version of this module (version 3.2.0).

Solution

I fixed it by doing :

import Snotify from 'vue-snotify/vue-snotify.min.js'

instead of

import Snotify from 'vue-snotify'

which loads the minimified version instead of the commonjs module, it works fine.

I'm creating this issue because

1. I looked into other vue-* modules (ex: vue-router) and there is no ES6 syntax in their final /dist files. It could be a good idea to transpile the code of this module too !

2. I also noticed that every files of this project get installed by npm :

vue-snotify-screenshot

There is probably stuff we don't need in there ? I think you can choose files installed using the files property in the package.json like so :

https://github.com/vuejs/vue-router/blob/e2a19cc9177a476051143f97ac21f231ff263406/package.json#L16-L19

Feel free to do something (or nothing) about it ! :smile:

wmcmurray avatar Jul 28 '18 19:07 wmcmurray

I'm having the same issue. Thanks for the work-around!

molund avatar Aug 03 '18 19:08 molund

You just saved my life. Thank you!

dougblackjr avatar Dec 11 '18 19:12 dougblackjr

Saved my life!

anselmobattisti avatar Jan 31 '19 19:01 anselmobattisti

You saved our life too, thanks. Freedomotic team

amenak77 avatar Apr 21 '20 20:04 amenak77