The plugins property
Use vue.js plugins with the plugins option of Nuxt.
Note: Since Nuxt 2.4, mode
has been introduced as option of plugins
to specify plugin type, possible value are: client
or server
. ssr: false
will be adapted to mode: 'client'
and deprecated in next major release.
-
Type:
Array
-
Items:
String
orObject
-
Items:
If the item is an object, the properties are:
-
src:
String
(path of the file) -
mode:
String
(can beclient
orserver
) If defined, the file will be included only on the respective (client or server) side.
Note: Old version
-
Type:
Array
-
Items:
String
orObject
-
Items:
If the item is an object, the properties are:
-
src:
String
(path of the file) -
ssr:
Boolean
(default totrue
) If false, the file will be included only on the client-side.
The plugins property lets you add Vue.js plugins easily to your main application.
nuxt.config.js
export default {
plugins: [
{ src: '~/plugins/both-sides.js' },
{ src: '~/plugins/client-only.js', mode: 'client' },
{ src: '~/plugins/server-only.js', mode: 'server' }
]
}
nuxt.config.js
export default {
plugins: ['@/plugins/ant-design-vue']
}
plugins/ant-design-vue.js
import Vue from 'vue'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css' // Per Ant Design's docs
Vue.use(Antd)
Note that the css was imported as per Ant Design Documentation
All the paths defined in the plugins
property will be imported before initializing the main application.
Edit this page on GitHub
Updated at Thu, Feb 9, 2023
Paiva
Florian Reuschel
Sébastien Chopin
Daniel Roe
Rishi Raj Jain
Clément Ollivier
Savas Vedova
Steven Soekha
Vinícius Alves
Kareem Dabbeet
Valentín Costa
Ryan Skinner
Alex Hirzel
Ajeet Chaulagain
René Eschke
Nico Devs
Muhammad
Nazaré da Piedade
Naoki Hamada
Tom
Yann Aufray
Anthony Chu
Nuzhat Minhaz
Lucas Portet
Richard Schloss
bpy
Antony Konstantinidis
Hibariya
Jose Seabra
Eze
Florian LEFEBVRE
Lucas Recoaro
Julien SEIXAS
Hugo
Sylvain Marroufin
Spencer Cooley
Piotr Zatorski
Vladimir Semenov
Harry Allen
kazuya kawaguchi
Unai Mengual
Hyunseung Lee
Alexandre Chopin
pooya parsa
Nick Medrano
Mosaab Emam
Iljs Путлер Капут
Heitor Ramon Ribeiro
Nero
Yoon Han
Ikko Eltociear Ashimine
FamCodings
Ayouli
F. Hinkelmann
felipesuri
Christophe Carvalho Vilas-Boas
Leoš Literák
Trizotti