Prime
Prime

Reputation: 2849

Can I use vue packages in nuxtjs?

Now I am working on a Nuxt project. Currently, there are many useful packages that make vue more enjoyable to use. But I've managed to find Nuxt packages. So I am wondering if there is any good way to use Vue packages in Nuxt projects. For example, vue has good packages related to google map including vue-google-maps. It would be great if I can use it in Nuxt.

Upvotes: 0

Views: 473

Answers (1)

SirGuelph
SirGuelph

Reputation: 15

vue-google-maps documentation has an example of how to add the package as a nuxt plugin. Add a js file (eg, google-maps.js) in your /plugins directory:

import Vue from 'vue'
import * as VueGoogleMaps from 'vue2-google-maps'

Vue.use(VueGoogleMaps, {
  // your config here
}

And then, in your nuxt.config.js:

  plugins: [
    { src: '~/plugins/google-maps' },
  ],

Most Vue packages should work just fine in Nuxt after these steps.

Upvotes: 1

Related Questions