Plugin API


Type: string

The version string for the @vue/cli-service version that is loading the plugin.


  • Arguments

    • {integer | string} range - a semver range that @vue/cli-service needs to satisfy
  • Usage

    While api.version can be useful in general, it's sometimes nice to just declare your version. This API exposes a simple way to do that.

    Nothing happens if the provided version is satisfied. Otherwise, an error will be thrown.

    Note: It's recommended to use the peerDependencies field in package.json under most circumstances.


  • Usage: Returns a current working directory


  • Arguments

    • {string} path - relative path from project root
  • Returns

    • {string}- the resolved absolute path
  • Usage: Resolve a path for the current project


  • Arguments

    • {string} id - plugin id, can omit the (@vue/|vue-|@scope/vue)-cli-plugin- prefix
  • Returns

    • {boolean}
  • Usage: Check if the project has a plugin with given id


  • Arguments

    • {string} name
    • {object} [opts]
      description: string,
      usage: string,
      options: { [string]: string }
    • {function} fn
    (args: { [string]: string }, rawArgs: string[]) => ?Promise
  • Usage: Register a command that will become available as vue-cli-service [name].


  • Arguments

    • {function} fn
  • Usage: Register a function that will receive a chainable webpack config. This function is lazy and won't be called until resolveWebpackConfig is called.


  • Arguments

    • {object | function} fn
  • Usage: Register a webpack configuration object that will be merged into the config OR a function that will receive the raw webpack config. The function can either mutate the config directly or return an object that will be merged into the webpack config.


  • Arguments

    • {object | function} fn
  • Usage: Register a dev serve config function. It will receive the express app instance of the dev server.


  • Arguments

    • {ChainableWebpackConfig} [chainableConfig]
  • Returns

    • {object} - raw webpack config
  • Usage: Resolve the final raw webpack config, that will be passed to webpack.


  • Returns

    • {ChainableWebpackConfig}
  • Usage: Resolve an intermediate chainable webpack config instance, which can be further tweaked before generating the final raw webpack config. You can call this multiple times to generate different branches of the base webpack config.



  • Arguments

    • id
    • partialIdentifier
    • configFiles
  • Returns

    • {object}
      cacheDirectory: string,
      cacheIdentifier: string }
  • Usage: Generate a cache identifier from a number of variables.