@vitejs/plugin-vue-jsx
TypeScript icon, indicating that this package has built-in type declarations

4.1.1 • Public • Published

@vitejs/plugin-vue-jsx npm

Provides Vue 3 JSX & TSX support with HMR.

// vite.config.js
import vueJsx from '@vitejs/plugin-vue-jsx'

export default {
  plugins: [
    vueJsx({
      // options are passed on to @vue/babel-plugin-jsx
    }),
  ],
}

Options

include

Type: (string | RegExp)[] | string | RegExp | null

Default: /\.[jt]sx$/

A picomatch pattern, or array of patterns, which specifies the files the plugin should operate on.

exclude

Type: (string | RegExp)[] | string | RegExp | null

Default: undefined

A picomatch pattern, or array of patterns, which specifies the files to be ignored by the plugin.

See @vue/babel-plugin-jsx for other options.

defineComponentName

Type: string[]

Default: ['defineComponent']

The name of the function to be used for defining components. This is useful when you have a custom defineComponent function.

HMR Detection

This plugin supports HMR of Vue JSX components. The detection requirements are:

  • The component must be exported.
  • The component must be declared by calling defineComponent or the name specified in defineComponentName via a root-level statement, either variable declaration or export declaration.

Supported patterns

import { defineComponent } from 'vue'

// named exports w/ variable declaration: ok
export const Foo = defineComponent({})

// named exports referencing variable declaration: ok
const Bar = defineComponent({ render() { return <div>Test</div> }})
export { Bar }

// default export call: ok
export default defineComponent({ render() { return <div>Test</div> }})

// default export referencing variable declaration: ok
const Baz = defineComponent({ render() { return <div>Test</div> }})
export default Baz

Non-supported patterns

// not using `defineComponent` call
export const Bar = { ... }

// not exported
const Foo = defineComponent(...)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.0-beta.00beta
3.0.0-alpha.00alpha
4.1.1
289,733latest

Version History

VersionDownloads (Last 7 Days)Published
4.1.1
289,733
4.1.0
39,551
4.0.1
108,832
4.0.0
40,410
3.1.0
129,410
3.0.215,395
3.0.123,260
3.0.03,136
3.0.0-beta.00
3.0.0-alpha.00
2.1.18,365
2.1.0123
2.1.0-beta.00
2.0.1976
2.0.0441
2.0.0-beta.00
2.0.0-alpha.10
2.0.0-alpha.00
1.3.107,307
1.3.9188
1.3.8170
1.3.792
1.3.561
1.3.410
1.3.380
1.3.296
1.3.130
1.3.020
1.3.0-beta.00
1.2.0223
1.1.8111
1.1.7271
1.1.6180
1.1.585
1.1.451
1.1.3134
1.1.290
1.1.10
1.1.00
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @vitejs/plugin-vue-jsx

Weekly Downloads

668,831

Version

4.1.1

License

MIT

Unpacked Size

23 kB

Total Files

8

Last publish

Collaborators

  • soda
  • yyx990803
  • patak
  • antfu
  • vitebot
  • sxzz