Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vite-plugin-vue2

underfin125.5kMIT2.0.3TypeScript support: included

Vite plugin for Vue2

vite, vue2

readme

vite-plugin-vue2

NPM version

⚠️ With the release of Vue 2.7, Vite now provides the official Vue 2 plugin @vitejs/plugin-vue2. Thereby this plugin has entered maintenance mode and will only support Vue 2.6 or earlier. This project will reach End of Life by the end of 2022.

Install

npm install vite-plugin-vue2 -D
// vite.config.js
import { createVuePlugin } from 'vite-plugin-vue2'

export default {
  plugins: [
    createVuePlugin(/* options */)
  ],
}

Options

vueTemplateOptions

Type: Object

Default: { compilerOptions :{ whitespace: 'condense' } }

Note { whitespace: 'condense' } behavior

  • A whitespace-only text node between element tags is removed if it contains new lines. Otherwise, it is condensed into a single space.

  • Consecutive whitespaces inside a non-whitespace-only text node are condensed into a single space.

Using condense mode will result in smaller compiled code size and slightly improved performance. However, it will produce minor visual layout differences compared to plain HTML in certain cases,if you want to keep whitespace behavior, please set { whitespace: 'preserve' }

The options for @vue/component-compiler-utils.

jsx

Type: Boolean
Default: false

The options for jsx transform.

jsxOptions

Type: Object

The options for @vue/babel-preset-jsx.

target

Type: String

The options for esbuild to transform script code

Todo

  • SSR Build
  • Sourcemap

changelog

2.0.3 (2022-12-19)

Features

2.0.2 (2022-07-16)

Features

2.0.1 (2022-05-18)

Bug Fixes

Features

2.0.0 (2022-04-23)

Bug Fixes

Features

  • migrate vite-plugin-vue2 to use vue-template-babel-compiler (#179) (d4a52ed)

1.9.3 (2022-01-25)

Bug Fixes

1.9.2 (2022-01-03)

Bug Fixes

1.9.1 (2022-01-03)

Bug Fixes

  • consider window path at set descriptor cache (bdfabc9), closes #129
  • don't inject hmr code in SSR (#159) (d84ffec)
  • missing sourcemap fields after compiling ts in dev (#158) (ee1ff2e)
  • no corresponding SFC entry in the cache (#155) (e1db32c)
  • use correct target types (f44ecea)
  • windows path contains \u symbols (#152) (#154) (cddd1e9)

1.9.0 (2021-10-15)

Bug Fixes

  • hmr doesn't work when modifying the code of jsx in sfc(#88) (#137) (66d6485)
  • prevent error when SFC script contains variable named render (#145) (7a6f9e9)

Features

  • add 'target' options for transform script code (#141) (940ec45)

1.8.2 (2021-09-07)

Bug Fixes

Features