drewjbartlett / vue-flickity

A Vue Slider / Carousel Component for Flickity.js
http://drewjbartlett.com/demos/vue-flickity/
375 stars 55 forks source link

Unexpected token < with SSR #20

Closed hackuun closed 7 years ago

hackuun commented 7 years ago

Hello. Great slider, but unfortunately I have issues with Nuxt. With no SSR setup all is working perfectly.

With Nuxt component breaks if I refresh the page. If I navigate to this page from other pages, then it works. So it breaks only on server.

[vue-router] Failed to resolve async component default: SyntaxError: Unexpected token <
[vue-router] uncaught error during route navigation:
/home/***/Documents/WORK/EXAMPLES/nuxt-examples/node_modules/vue-flickity/flickity.vue:1
(function (exports, require, module, __filename, __dirname) { <template>
                                                              ^

SyntaxError: Unexpected token <
hackuun commented 7 years ago

I tried no-ssr plugin, it didn't help. I think this issue is specifically to this Component.

cj commented 7 years ago

@iamdubx try doing this https://nuxtjs.org/guide/plugins#vue-plugins

hackuun commented 7 years ago

Unfortunately, this one not working.

hackuun commented 7 years ago

Fixed https://github.com/nuxt/nuxt.js/issues/1536#issuecomment-326294194

camilodelvasto commented 6 years ago

I'm experiencing the same, but I don't seem to find what I'm doing wrong... :(

Here a glitch (won't work there as it will require more than 128MB, but I just downloaded it and got the error shown below): https://glitch.com/edit/#!/cute-denim

Can you guys please shed some light on what am I doing wrong?

  nuxt:render Rendering url / +0ms
[vue-router] Failed to resolve async component default: SyntaxError: Unexpected token <
[vue-router] uncaught error during route navigation:
/Users/me/Documents/play/nuxt-flickity/node_modules/vue-flickity/flickity.vue:1
(function (exports, require, module, __filename, __dirname) { <template>
                                                              ^

SyntaxError: Unexpected token <
camilodelvasto commented 6 years ago

This worked for me after I wrapped flickity into <no-ssr> tag ¯_(ツ)_/¯