@vitejs/plugin-vue

  • Version 5.2.1
  • Published
  • 198 kB
  • No dependencies
  • MIT license

Install

npm i @vitejs/plugin-vue
yarn add @vitejs/plugin-vue
pnpm add @vitejs/plugin-vue

Overview

> Note: as of `vue` 3.2.13+ and `@vitejs/plugin-vue` 1.9.0+, `@vue/compiler-sfc` is no longer required as a peer dependency.

Index

Functions

function parseVueRequest

parseVueRequest: (id: string) => { filename: string; query: VueQuery };

    function vuePlugin

    vuePlugin: (rawOptions?: Options) => Plugin<Api>;

      Interfaces

      interface Api

      interface Api {}

        property version

        version: string;

          index signature

          get options(): ResolvedOptions;

            index signature

            set options(value: ResolvedOptions);

              interface Options

              interface Options {}

                property compiler

                compiler?: typeof _compiler;
                • Use custom compiler-sfc instance. Can be used to force a specific version.

                property customElement

                customElement?: boolean | string | RegExp | (string | RegExp)[];
                • Deprecated

                  moved to features.customElement.

                property exclude

                exclude?: string | RegExp | (string | RegExp)[];

                  property features

                  features?: {
                  /**
                  * Enable reactive destructure for `defineProps`.
                  * - Available in Vue 3.4 and later.
                  * - **default:** `false` in Vue 3.4 (**experimental**), `true` in Vue 3.5+
                  */
                  propsDestructure?: boolean;
                  /**
                  * Transform Vue SFCs into custom elements.
                  * - `true`: all `*.vue` imports are converted into custom elements
                  * - `string | RegExp`: matched files are converted into custom elements
                  * - **default:** /\.ce\.vue$/
                  */
                  customElement?: boolean | string | RegExp | (string | RegExp)[];
                  /**
                  * Set to `false` to disable Options API support and allow related code in
                  * Vue core to be dropped via dead-code elimination in production builds,
                  * resulting in smaller bundles.
                  * - **default:** `true`
                  */
                  optionsAPI?: boolean;
                  /**
                  * Set to `true` to enable devtools support in production builds.
                  * Results in slightly larger bundles.
                  * - **default:** `false`
                  */
                  prodDevtools?: boolean;
                  /**
                  * Set to `true` to enable detailed information for hydration mismatch
                  * errors in production builds. Results in slightly larger bundles.
                  * - **default:** `false`
                  */
                  prodHydrationMismatchDetails?: boolean;
                  /**
                  * Customize the component ID generation strategy.
                  * - `'filepath'`: hash the file path (relative to the project root)
                  * - `'filepath-source'`: hash the file path and the source code
                  * - `function`: custom function that takes the file path, source code,
                  * whether in production mode, and the default hash function as arguments
                  * - **default:** `'filepath'` in development, `'filepath-source'` in production
                  */
                  componentIdGenerator?:
                  | 'filepath'
                  | 'filepath-source'
                  | ((
                  filepath: string,
                  source: string,
                  isProduction: boolean | undefined,
                  getHash: (text: string) => string
                  ) => string);
                  };
                  • Requires @vitejs/plugin-vue@^5.1.0

                  property include

                  include?: string | RegExp | (string | RegExp)[];

                    property isProduction

                    isProduction?: boolean;
                    • In Vite, this option follows Vite's config.

                    property script

                    script?: Partial<
                    Omit<
                    SFCScriptCompileOptions,
                    | 'id'
                    | 'isProd'
                    | 'inlineTemplate'
                    | 'templateOptions'
                    | 'sourceMap'
                    | 'genDefaultAs'
                    | 'customElement'
                    | 'defineModel'
                    | 'propsDestructure'
                    >
                    > & {
                    /**
                    * @deprecated defineModel is now a stable feature and always enabled if
                    * using Vue 3.4 or above.
                    */
                    defineModel?: boolean;
                    /**
                    * @deprecated moved to `features.propsDestructure`.
                    */
                    propsDestructure?: boolean;
                    };

                      property style

                      style?: Partial<
                      Omit<
                      SFCStyleCompileOptions,
                      | 'filename'
                      | 'id'
                      | 'isProd'
                      | 'source'
                      | 'scoped'
                      | 'cssDevSourcemap'
                      | 'postcssOptions'
                      | 'map'
                      | 'postcssPlugins'
                      | 'preprocessCustomRequire'
                      | 'preprocessLang'
                      | 'preprocessOptions'
                      >
                      >;

                        property template

                        template?: Partial<
                        Omit<
                        SFCTemplateCompileOptions,
                        | 'id'
                        | 'source'
                        | 'ast'
                        | 'filename'
                        | 'scoped'
                        | 'slotted'
                        | 'isProd'
                        | 'inMap'
                        | 'ssr'
                        | 'ssrCssVars'
                        | 'preprocessLang'
                        >
                        >;

                          interface ResolvedOptions

                          interface ResolvedOptions extends Options {}

                            property compiler

                            compiler: typeof _compiler;

                              property cssDevSourcemap

                              cssDevSourcemap: boolean;

                                property devServer

                                devServer?: ViteDevServer;

                                  property devToolsEnabled

                                  devToolsEnabled?: boolean;

                                    property root

                                    root: string;

                                      property sourceMap

                                      sourceMap: boolean;

                                        interface VueQuery

                                        interface VueQuery {}

                                          property id

                                          id?: string;

                                            property index

                                            index?: number;

                                              property lang

                                              lang?: string;

                                                property raw

                                                raw?: boolean;

                                                  property scoped

                                                  scoped?: boolean;

                                                    property src

                                                    src?: string;

                                                      property type

                                                      type?: 'script' | 'template' | 'style' | 'custom';

                                                        property url

                                                        url?: boolean;

                                                          property vue

                                                          vue?: boolean;

                                                            Package Files (1)

                                                            Dependencies (0)

                                                            No dependencies.

                                                            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/@vitejs/plugin-vue.

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