@vue/cli-service

  • Version 5.0.8
  • Published
  • 175 kB
  • 55 dependencies
  • MIT license

Install

npm i @vue/cli-service
yarn add @vue/cli-service
pnpm add @vue/cli-service

Overview

local service for vue-cli projects

Index

Functions

function defineConfig

defineConfig: (config: UserConfig) => UserConfig;

    Classes

    class PluginAPI

    class PluginAPI {}

      property id

      id: string;

        property service

        service: any;

          property version

          readonly version: string;

            method assertVersion

            assertVersion: (range: number | string) => void;

              method chainWebpack

              chainWebpack: (fn: WebpackChainFn) => void;
              • Register a function that will receive a chainable webpack config the function is lazy and won't be called until resolveWebpackConfig is called

                Parameter fn

              method configureDevServer

              configureDevServer: (fn: DevServerConfigFn) => void;
              • Register a dev serve config function. It will receive the express app instance of the dev server.

                Parameter fn

              method configureWebpack

              configureWebpack: (fn: webpackRawConfigFn) => void;
              • 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 config.

                Parameter fn

              method genCacheConfig

              genCacheConfig: (
              id: string,
              partialIdentifier: any,
              configFiles?: string | string[]
              ) => CacheConfig;
              • Generate a cache identifier from a number of variables

              method getCwd

              getCwd: () => string;
              • Current working directory.

              method hasPlugin

              hasPlugin: (id: string) => boolean;
              • Check if the project has a given plugin.

                Parameter id

                Plugin id, can omit the (@vue/|vue-|@scope/vue)-cli-plugin- prefix boolean

              method registerCommand

              registerCommand: {
              (name: string, fn: RegisterCommandFn): void;
              (
              name: string,
              opts: Partial<{
              description: string;
              usage: string;
              options: { [flags: string]: string };
              details: string;
              }>,
              fn: RegisterCommandFn
              ): void;
              };
              • Register a command that will become available as vue-cli-service [name].

                Parameter name

                Parameter opts

                Parameter fn

              method resolve

              resolve: (_path: string) => string;
              • Resolve path for a project.

                Parameter _path

                Relative path from project root The resolved absolute path.

              method resolveChainableWebpackConfig

              resolveChainableWebpackConfig: () => ChainableConfig;
              • 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. See https://github.com/mozilla-neutrino/webpack-chain

                ChainableWebpackConfig

              method resolveWebpackConfig

              resolveWebpackConfig: (
              chainableConfig?: ChainableConfig
              ) => webpack.Configuration;
              • Resolve the final raw webpack config, that will be passed to webpack.

                Parameter chainableConfig

                Raw webpack config.

              Interfaces

              interface ProjectOptions

              interface ProjectOptions {}

                property assetsDir

                assetsDir?: string;
                • Default: ''

                  A directory (relative to outputDir) to nest generated static assets (js, css, img, fonts) under

                property chainWebpack

                chainWebpack?: (config: ChainableWebpackConfig) => void;
                • A function that will receive an instance of ChainableConfig powered by [webpack-chain](https://github.com/mozilla-neutrino/webpack-chain)

                property configureWebpack

                configureWebpack?:
                | WebpackOptions
                | ((config: WebpackOptions) => WebpackOptions | void);
                • Set webpack configuration. If the value is Object, will be merged into config. If value is Function, will receive current config as argument

                property crossorigin

                crossorigin?: '' | 'anonymous' | 'use-credentials';
                • Default: undefined

                  Configure the crossorigin attribute on <link rel="stylesheet"> and <script> tags in generated HTML

                property css

                css?: CSSOptions;

                  property devServer

                  devServer?: { proxy?: string | object; [key: string]: any };
                  • [All options for webpack-dev-server](https://webpack.js.org/configuration/dev-server/) are supported

                  property filenameHashing

                  filenameHashing?: boolean;
                  • Default: true

                    By default, generated static assets contains hashes in their filenames for better caching control

                  property indexPath

                  indexPath?: string;
                  • Default: 'index.html'

                    Specify the output path for the generated index.html (relative to outputDir). Can also be an absolute path

                  property integrity

                  integrity?: boolean;
                  • Default: false

                    Set to true to enable [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) (SRI) on <link rel="stylesheet"> and <script> tags in generated HTML

                  property lintOnSave

                  lintOnSave?: boolean | 'default' | 'warning' | 'error';
                  • Default: 'default'

                    Whether to perform lint-on-save during development using [eslint-loader](https://github.com/webpack-contrib/eslint-loader)

                  property outputDir

                  outputDir?: string;
                  • Default: 'dist'

                    The directory where the production build files will be generated in when running vue-cli-service build

                  property pages

                  pages?: {
                  [key: string]: PageEntry | PageConfig;
                  };
                  • Default: undefined

                    Build the app in multi-page mode

                  property parallel

                  parallel?: boolean | number;
                  • Default: require('os').cpus().length > 1

                    Whether to use thread-loader for Babel or TypeScript transpilation

                  property pluginOptions

                  pluginOptions?: object;
                  • This is an object that doesn't go through any schema validation, so it can be used to pass arbitrary options to 3rd party plugins

                  property productionSourceMap

                  productionSourceMap?: boolean;
                  • Default: true

                    Setting this to false can speed up production builds if you don't need source maps for production

                  property publicPath

                  publicPath?: string;
                  • Default: '/'

                    The base URL your application bundle will be deployed at

                  property pwa

                  pwa?: object;
                  • Pass options to the [PWA Plugin](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa)

                  property runtimeCompiler

                  runtimeCompiler?: boolean;
                  • Default: false

                    Whether to use the build of Vue core that includes the runtime compiler

                  property terser

                  terser?: {
                  /**
                  * Supported minify: [terser](https://github.com/webpack-contrib/terser-webpack-plugin#minify), [esbuild](https://github.com/webpack-contrib/terser-webpack-plugin#esbuild), [swc](https://github.com/webpack-contrib/terser-webpack-plugin#swc), [uglifyJs](https://github.com/webpack-contrib/terser-webpack-plugin#uglify-js). currently we do not allow custom minify function
                  *
                  * In the non-terser case, you should install the corresponding package (eg. `npm i esbuild -D`)
                  *
                  */
                  minify: 'terser' | 'esbuild' | 'swc' | 'uglifyJs';
                  /**
                  * `terserOptions` options will be passed to minify
                  *
                  * [All options for `terser`](https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions)
                  *
                  * [All options for `esbuild`](https://github.com/evanw/esbuild/blob/master/lib/shared/types.ts#L160-L174)
                  *
                  * [All options for `swc`](https://swc.rs/docs/config-js-minify)
                  *
                  * [All options for `uglifyJs`](https://github.com/mishoo/UglifyJS#minify-options)
                  */
                  terserOptions?: PredefinedOptions<import('terser').MinifyOptions>;
                  };
                  • set terser-webpack-plugin minify and terserOptions

                  property transpileDependencies

                  transpileDependencies?: boolean | Array<string | RegExp>;
                  • Default: false

                    If set to true, all dependencies in node_modules will be transpiled by Babel; Or, if you only want to selectively transpile some of the dependencies, you can list them in this option.

                  Type Aliases

                  type ServicePlugin

                  type ServicePlugin = (api: PluginAPI, options: ProjectOptions) => any;
                  • Service plugin serves for modifying webpack config, creating new vue-cli service commands or changing existing commands

                    Parameter api

                    A PluginAPI instance

                    Parameter options

                    An object containing project local options specified in vue.config.js, or in the "vue" field in package.json.

                  Package Files (2)

                  Dependencies (55)

                  Dev Dependencies (8)

                  Peer Dependencies (2)

                  Badge

                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@vue/cli-service.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@vue/cli-service)
                  • HTML
                    <a href="https://www.jsdocs.io/package/@vue/cli-service"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>