Some Vue plugins are already pre-installed for us in Nuxt, such as vue-router, vue-meta, vuex, and vue-server-renderer. The plugins that are not installed can be sorted easily following the steps that we used to install our custom Vue plugin in the previous section. Here is an example of how we can use vue-notifications in our Nuxt app:
- Install the plugin using npm:
$ npm i vue-notification
- Import and inject the plugin just like we did with our custom one:
// plugins/vue-notifications.js
import Vue from 'vue'
import VueNotifications from 'vue-notifications'
Vue.use(VueNotifications)
- Include the file path to the Nuxt config file:
// nuxt.config.js:
export default {
plugins: ['~/plugins/vue-notifications']
}
For plugins that have no SSR support, or for when you just want to use this plugin on the client side only, you can use the mode: 'client' ...