Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uglifier complains with Unexpected token: operator (>) in 0.10.5 #24

Closed
patrickjahns opened this issue Aug 2, 2017 · 11 comments
Closed

Comments

@patrickjahns
Copy link

Removing the intermediate vue leads to problems with UglifyJs:

ERROR in js/index.js from UglifyJs
Unexpected token: operator (>) [./~/vue-masonry/src/masonry.plugin.js:19,0][js/index.js:75261,27]

Not sure how or if it can be fixed?

@shershen08
Copy link
Owner

can you try with https://github.com/shershen08/vue-masonry/blob/master/src/masonry.plugin.js#L19 like this ?
const stringToBool = (val) => (val + '').toLowerCase() === 'true';
I can't reproduce the setup to test right now, but I could roll the fix today

@patrickjahns
Copy link
Author

I tried but it would still fail with the mentioned error (just different character place). I don't quite understand how the intermediate vue would not cause this issue -_-

@shershen08
Copy link
Owner

OK I'll check that today

@shershen08
Copy link
Owner

@patrickjahns can you check this repo i've cretaed with vue-masonry and adding uglifyjs-webpack-plugin
https://github.com/shershen08/vue-masonry-plugin-demo

And it seem to work fin for me

@patrickjahns
Copy link
Author

will do as soon as I can get around provide feedback

@proov
Copy link

proov commented Aug 6, 2017

Hello guys !

I Have this issue too using Nuxt.js lastest 1.0.0-rc3, Vue-Masonry 0.10.6 and Masonry 4.2.0. I did exactly what they said in the nuxt.js documentation :

  1. create ~plugins/vue-masonry.js with this code inside:
import Vue from 'vue'
import VueMasonryPlugin from 'vue-masonry'

Vue.use(VueMasonryPlugin)
  1. Reference the plugin in nuxt.config.js:
module.exports = {
  /*
  ** Plugins
  */
  plugins: ['~plugins/vue-masonry'],
  /*
  ** Other stuffs
  */
}
  1. I put your little piece of code in a Vue Component ~components/Masonry.vue
<template>
  <div v-masonry origin-left="false" transition-duration="0s" item-selector=".item">
    <div v-masonry-tile class="item">
      lol
    </div>
  </div>
</template>

results in :

ERROR in vendor.bundle.b0a0b374ac713a5680b0.js from UglifyJs
Unexpected token: operator (>) [./node_modules/vue-masonry/src/masonry.plugin.js:19,0][vendor.bundle.b0a0b374ac713a5680b0.js:16836,26]

Any idea to how to fix this ? 🤔

Thanks ✋

@shershen08
Copy link
Owner

@proov can you show how you included / configured the UglifyJS plugin?

@proov
Copy link

proov commented Aug 6, 2017

@shershen08 I dont know :( I'm using Nuxt.js right out the box, i installed it with vue init nuxt/starter <project-name>

However, i located node_modules/nuxt/package.json there is "uglify-js": "^3.0.23", does it help you ?

@shershen08
Copy link
Owner

shershen08 commented Aug 7, 2017

@patrickjahns any news on that one ?

@shershen08
Copy link
Owner

I've tried to investigate that error and seem that Unexpected token: operator (>) may occur commonly if you version of UglifyJS or your uglifyjs settings do not support ES6 features.

With proper setting it should work fine.

  1. Check some of those links:
  1. Take a look at that sample repo with Vue + Vue-masonry + UglifyJS I've created - https://github.com/shershen08/vue-masonry-plugin-demo
    uglifyjs-webpack-plugin uses https://www.npmjs.com/package/uglify-es btw

I am open for a feedback if you say it's a bug in vue-masonry file. Please feel free to reopen if you have further considerations. But for now I see it as matter of configuration of your project, not a bug of vue-masonry plugin.

@patrickjahns
Copy link
Author

Sorry for the delayed response - thank you very much for checking - I will see that we implement your solution and eget back to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants