2

I'm trying to make a cropped image and then upload it to amazon in my NuxtJs app. The problem comes when I import library vue-image-crop-upload and get unexpected token <. Or briefly Syntax error

I tried using no-ssr but looks like a problem inside actual module.

                        // Usage in component
                        <no-ssr>
                            <button class="btn btn-primary upload-picture" @click="toggleShow">Cargar imagen</button>
                            <avatar-upload field="img"
                               @crop-success="cropSuccess"
                               v-model="show"
                               :no-square="true"
                               :width="500"
                                lang-type="en"
                               :height="500"
                               :params="params"
                               :headers="headers"
                               img-format="png"></avatar-upload>
                            <img :src="imgDataUrl">
                        </no-ssr>

import VueImageCropUpload from 'vue-image-crop-upload';


                        // Plugin registered
                        import Vue from 'vue';
                        import myUpload from 'vue-image-crop-upload';

                         Vue.component('avatar', myUpload);
                         // nuxt.config.js
                         plugins: [
                           {src: 'plugins/VueCropper', ssr: false},],
                         vendor: ['jquery', 'bootstrap', 'vue-image-crop-upload'],

I expect it working on nuxt.js. Client rendered app on which i tried to do the same works perfect

1
  • Did you solve it ? and How did you ? Commented Jun 23, 2019 at 15:49

1 Answer 1

2

Have you tried adding the package to nuxt.js transpile config?

in nuxt.config.js

  build: {
    transpile: ['vue-image-crop-upload' ]
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.