API: The plugins Property
Note: Since Nuxt.js 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:
StringorObject
- Items:
If the item is an object, the properties are:
- src:
String(path of the file) - mode:
String(can beclientorserver) If defined, the file will be included only on the respective (client or server) side.
Note: Old version
- Type:
Array- Items:
StringorObject
- 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.
export default {
plugins: [
{ src: '~/plugins/both-sides.js' },
{ src: '~/plugins/client-only.js', mode: 'client' },
{ src: '~/plugins/server-only.js', mode: 'server' }
]
}
export default {
plugins: ['@/plugins/ant-design-vue']
}
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.
Contributors
Daniel Roe
Sébastien Chopin
Debbie O'Brien
Benjamin Canac
fgiraud
Sergey Bedritsky
Alba Silvente Fuentes
Alexander Lichter
Krutie Patel
pooya parsa
Pim
Ahad Birang
Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!
