Currently there is a pretty neat doc on how to write plugins (https://github.com/vuejs/vue-cli/blob/dev/docs/plugin-dev.md) but i can;t see anywhere instructions how and where I should register it after creating. Is there a possibility of adding it to the docs? It is also possible that I missed it somewhere - then please share a link.
Thanks in advance
Which file should contain the plugin registration and how to register it.
Install the plugin into the project you wish to use it and call it with vue cli.
cd your/project/dir
npm install --save-dev vue-cli-plugin-someplugin
vue invoke someplugin
You can see how vue cli looks up a plugin in:
vue-cli/packages/@vue/cli/lib/invoke.js
line 41
Docs are here, btw:
https://github.com/vuejs/vue-cli/blob/dev/docs/cli.md#installing-plugins-in-an-existing-project
Edit: Maybe we should be more explicit that this applies to 3rd party plugins as well?
@LinusBorg definietely ;) And more straightforward instructions on plugin installation process would be great
Was vue add replaced by vue invoke? The installing plugins in an existing project documentation uses vue add, but the commands listing at the top of the CLI documentation only lists vue invoke. Or is vue invoke 3rd-party oriented and vue add is meant for @vue/cli-plugin-* plugins?
Those are different commands. add installs a plugin and then calls invoke for it.
We appearantly forgot to add it to the list.
So if I'd like to test my own custom plugin, I'd install it with npm from a local path and then only invoke, skipping the npm install part of add, right?
Exactly
I think what the CLI is currently really lacking is the ability to register global plugins that can be used during generation. I don't see a good reason why that shouldn't be possible
@light24bulbs you already created a separate issue for your request, please don't clutter other issues with it.
I find the docs are lacking this info too, had too google it and find it here. One short section reflecting what has been said here would be awesome.
Closing as this is addressed in the refactored docs.
Most helpful comment
Install the plugin into the project you wish to use it and call it with vue cli.
You can see how vue cli looks up a plugin in:
vue-cli/packages/@vue/cli/lib/invoke.js
line
41