Dom Huxley
Dom Huxley

Reputation: 113

Unable to use standard Vue plugin with Nuxt

Trying to get the Dragabilly Vue plugin to work with my Nuxt app: https://www.npmjs.com/package/vue-draggabilly

I've used the usual approach that has worked with similar plugins but I don't have the depth of knowledge to crack this one. I am adding into my nuxt config file:

plugins: [ { src: '~/plugins/vue-draggabilly.js', ssr: false } ]

That file includes this code:

import Vue from 'vue'
import VueDraggabilly from 'vue-draggabilly'

Vue.use(VueDraggabilly)

However, I get the following error and I'm not able to use:

vue-draggabilly.js:3 Uncaught ReferenceError: exports is not defined

This refers to this line in the plugin:

exports.install = function (Vue, options) { ....

It is a usual vuew plugin package, but I'm not sure how to get it to work with nuxt. Any help very greatly appreciated!

Upvotes: 0

Views: 2971

Answers (1)

Paul Tsai
Paul Tsai

Reputation: 1009

I see a warning:

warning in ./plugins/vue-draggabilly.js

4:8-22 "export 'default' (imported as 'VueDraggabilly') was not found in 'vue-draggabilly'

I don't know the best answer, but this seems to work:

import Vue from 'vue'
import * as VueDraggabilly from 'vue-draggabilly'

Vue.use(VueDraggabilly)

Upvotes: 1

Related Questions