Agontuk/vue-cropperjs

vendors.app.js:formatted: Uncaught ReferenceError: exports is not defined

nelsonlarocca opened this issue · 4 comments

The error is triggered at vendorsapp.js
line content:
Object.defineProperty(exports, "__esModule", {
value: true
});


// /nuxt.config.js
module.exports = {
plugins: [
{ src: '~/plugins/vue-cropper', ssr: false }
],
build: {
transpile: [
'vue-cropperjs'
],
}
}

// plugins/vue-cropper.js
import Vue from 'vue';
import VueCropper from 'vue-cropperjs';
Vue.use(VueCropper);

I also got:
WARN in ./plugins/vue-cropper.js friendly-errors 14:51:25

"export 'default' (imported as 'VueCropper') was not found in 'vue-cropperjs'

using Nuxt ver 2.8.x

Thanks !

Can you provide a example repo which can reproduce this issue ? I haven't yet used Nuxt.js so need a sample project to test it.

same to me,
any fix ?
thanks

Closing due to inactivity, it should be ok now.

I think it doesn't work when you use it as a nuxt plugin. But it works when you import it as a local component. Just make sure to wrap it inside <client-only></client-only>