-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Description
What problem does this feature solve?
We have a number of complex, tightly coupled build processes which take advantage of direct access to the webpack config and starting development servers. In looking to migrate to vue-cli, we don't have the same access without being a plugin which are only loaded via package dependencies. The proposal is to specify local plugins, specific to the project.
While for our case it would be for adding adding commands, we also see the benefit in being able to provide per-project UI add-ons.
Alternatives:
- Using a file dependency in
package.json
- What we'll likely do w/out this feature. e.g. have a dependency of'vue-cli-plugin-OurPlugin': 'file: local/path'
. Downside is the need to ensure thatnpm -i
is called prior to any use to keep the copy in node-modules up to date. - Splitting code into a separate module and use a git dependency - Besides being a much heavier lift and re-architecting (not wrong, just not feasible at the moment), this is project specific code that doesn't make sense to be separated.
- Abuse of
vue-cli-service inspect
- Saving webpack config to a temp file to run dev server, etc.
What does the proposed API look like?
A vue.config.js field -
local-plugins: {
my-plugin: 'path/relative/to/package.json',
}
Implementation Notes
I can create a PR with a basic implementation, but would like to make sure it is the right approach first.
Approach: Add a function to init
to concat local plugins here: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/Service.js#L72