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

4.2.0 • 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-alpha.00alpha
4.2.0
283,166latest
5.0.0-beta.0
58beta

Version History

VersionDownloads (Last 7 Days)Published
5.0.0-beta.0
58
4.2.0
283,166
4.1.2
196,567
4.1.1
121,132
4.1.0
11,303
4.0.1
55,743
4.0.0
30,685
3.1.0
122,439
3.0.214,252
3.0.124,260
3.0.03,392
3.0.0-beta.00
3.0.0-alpha.00
2.1.126,522
2.1.0261
2.1.0-beta.00
2.0.11,159
2.0.0313
2.0.0-beta.00
2.0.0-alpha.11
2.0.0-alpha.00
1.3.106,374
1.3.9107
1.3.8205
1.3.728
1.3.5655
1.3.410
1.3.367
1.3.242
1.3.1119
1.3.026
1.3.0-beta.00
1.2.0886
1.1.89
1.1.717
1.1.684
1.1.510
1.1.45
1.1.33
1.1.25
1.1.10
1.1.03
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @vitejs/plugin-vue-jsx

Weekly Downloads

899,908

Version

4.2.0

License

MIT

Unpacked Size

25.1 kB

Total Files

8

Last publish

Collaborators

  • yyx990803
  • patak
  • antfu
  • vitebot
  • sxzz