Skip to content

Feature: Local Plugins #1841

@mwaldstein

Description

@mwaldstein

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 that npm -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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions