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

4.1.2 • 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
4.1.2
336,349latest
3.0.0-beta.01beta
3.0.0-alpha.01alpha

Version History

VersionDownloads (Last 7 Days)Published
4.1.2
336,349
4.1.1
136,494
4.1.0
15,137
4.0.1
56,854
4.0.0
20,597
3.1.0
102,248
3.0.214,024
3.0.122,962
3.0.02,090
3.0.0-beta.01
3.0.0-alpha.01
2.1.18,462
2.1.0106
2.1.0-beta.01
2.0.1564
2.0.0282
2.0.0-beta.00
2.0.0-alpha.10
2.0.0-alpha.00
1.3.104,972
1.3.9106
1.3.8122
1.3.718
1.3.5443
1.3.43
1.3.340
1.3.272
1.3.136
1.3.029
1.3.0-beta.01
1.2.0658
1.1.814
1.1.713
1.1.667
1.1.58
1.1.46
1.1.3136
1.1.22
1.1.10
1.1.01
1.0.31
1.0.20
1.0.11
1.0.00

Package Sidebar

Install

npm i @vitejs/plugin-vue-jsx

Weekly Downloads

722,921

Version

4.1.2

License

MIT

Unpacked Size

23.4 kB

Total Files

8

Last publish

Collaborators

  • yyx990803
  • patak
  • antfu
  • vitebot
  • sxzz