swc-plugin-vue-jsx

SWC plugin for transforming Vue JSX.
11,721 98
Install
npm install swc-plugin-vue-jsx
Latest Version:0.4.0
License:MIT
Last Updated:Aug 23, 2025
Links: GitHub  ·  npm
Maintainer: gplane

SWC Plugin for Vue JSX

SWC plugin for transforming Vue JSX, mostly ported from official Babel plugin. It only supports Vue.js v3 or newer.

Installation

npm i -D swc-plugin-vue-jsx

Configuration

You can configure your .swcrc file.

Minimum Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": true
    },
    "experimental": {
      "plugins": [["swc-plugin-vue-jsx", {}]]
    }
  }
}

Options

These options of official Babel plugin are supported:

  • transformOn
  • optimize
  • mergeProps
  • enableObjectSlots
  • pragma
  • resolveType (Types imported from other modules aren't supported.)

For details, please refer to official documentation.

The isCustomElement can't be supported directly, because SWC config only allows JSON, so we introduce the customElementPatterns option instead.

It accepts an array of strings which represent regex.

For example:

[
  "swc-plugin-vue-jsx",
  {
    "customElementPatterns": ["^i-"]
  }
]

All HTML tags which match the pattern ^i- will be treated as custom elements.

Advanced Config Example

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": true
    },
    "experimental": {
      "plugins": [
        [
          "swc-plugin-vue-jsx",
          {
            "transformOn": true,
            "optimize": true
          }
        ]
      ]
    }
  }
}

License

MIT License

Copyright (c) 2022-present Pig Fang

Related Packages

swc-plugin-transform-vue3-jsx

SWC plugin for transform Vue3-jsx syntax

1,587 7
swc-plugin-auto-import

SWC plugin for auto importing APIs on-demand, inspired by unplugin-auto-import

2,686 0
@designless/annotate

Build-time source markers so Designless can route a rendered element back to its...

1,499 0

Version History

Version Released License
0.4.0 MIT
0.3.2 MIT
0.3.1 MIT
0.3.0 MIT
0.2.7 MIT