Hello, this a probably a noob question but i still do not have a clear understating of the differences.
What i know is that vendor is used for things you need a lot and do not re include in every page.
On the official websites it says Modules is for nuxt modules what does that mean? If i want to use vue-notification or vue-select is that a module or plugin?
One more question: if in a plugin i do: Vue.use(pluginName)
doesn't that mean that it is available in Vue globally and can be used in any page which means no need to add that plugin in build/vendor?
vendor
file and can be cached by browser and your application will be smaller.axios
in the component of each page, you can write a plugin that imports axios
and embeds it in the prototype Vue objects, context, storage, etc.vue-notification
to vendor and also will add the plugin that will import vue-notification
and make Vue to use it. Read documentation there are very good examplesAbout last question - yes it will be available globally. But you still have to add it to vendor, because otherwise the code of this library will be like a part of your application, not like a library
I was quite confused by plugins and modules. Now I seem to have a better understanding and want to put my answer here.
It seems that one, maybe the most important, difference that neither the document nor this post properly addressed, is that:
Plugin is something be imported in client application. That means it's imported either in browser, or when server doing server side rendering.
Module is something be executed upon nuxt boot up, and is able to customize the nuxt application in almost any way. For example, module can add a plugin to the nuxt application.
However, can we skip the plugin and just let module do the work of plugin (like calling Vue.use)? No. Module is executed upon nuxt boot up, meaning it's executed on the nuxt server, or nuxt generate, but not on browser. So module can add a plugin to the nuxt application but cannot skip the plugin and just do something the plugin suppose to do.
I have just started working with nuxt so please correct me if I'm wrong.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
vendor
file and can be cached by browser and your application will be smaller.axios
in the component of each page, you can write a plugin that importsaxios
and embeds it in the prototype Vue objects, context, storage, etc.vue-notification
to vendor and also will add the plugin that will importvue-notification
and make Vue to use it. Read documentation there are very good examplesAbout last question - yes it will be available globally. But you still have to add it to vendor, because otherwise the code of this library will be like a part of your application, not like a library