# vite-plugin-vue2-jsx

> Vite plugin for Vue2

Latest version **1.0.3** (published 2022-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-plugin-vue2-jsx
pnpm add vite-plugin-vue2-jsx
yarn add vite-plugin-vue2-jsx
bun add vite-plugin-vue2-jsx
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-03-28 |
| First published | 2022-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 20 |
| Unpacked size | 121.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | hujinbin |
| Keywords | vite, vue2 |

## Links

- npm: https://www.npmjs.com/package/vite-plugin-vue2-jsx
- npm.io page: https://npm.io/package/vite-plugin-vue2-jsx

## Dependencies (20)

- [debug](https://npm.io/package/debug.md) ^4.3.2
- [slash](https://npm.io/package/slash.md) ^3.0.0
- [rollup](https://npm.io/package/rollup.md) ^2.58.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.1.0
- [hash-sum](https://npm.io/package/hash-sum.md) ^2.0.0
- [prettier](https://npm.io/package/prettier.md) ^2.4.1
- [source-map](https://npm.io/package/source-map.md) ^0.7.3
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.16.10
- [consolidate](https://npm.io/package/consolidate.md) ^0.16.0
- [querystring](https://npm.io/package/querystring.md) ^0.2.1
- [magic-string](https://npm.io/package/magic-string.md) ^0.25.7
- [@babel/parser](https://npm.io/package/@babel/parser.md) ^7.16.10
- [@rollup/pluginutils](https://npm.io/package/@rollup/pluginutils.md) ^4.1.1
- [@vue/babel-preset-jsx](https://npm.io/package/@vue/babel-preset-jsx.md) ^1.2.4
- [vue-template-es2015-compiler](https://npm.io/package/vue-template-es2015-compiler.md) ^1.9.1
- [@vue/component-compiler-utils](https://npm.io/package/@vue/component-compiler-utils.md) ^3.2.2
- [@babel/plugin-proposal-decorators](https://npm.io/package/@babel/plugin-proposal-decorators.md) ^7.16.7
- [@babel/plugin-transform-typescript](https://npm.io/package/@babel/plugin-transform-typescript.md) ^7.16.8
- [@vue/babel-helper-vue-jsx-merge-props](https://npm.io/package/@vue/babel-helper-vue-jsx-merge-props.md) ^1.2.1
- [@babel/plugin-proposal-class-properties](https://npm.io/package/@babel/plugin-proposal-class-properties.md) ^7.16.7

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2022-03-28
- 1.0.2 — 2022-03-17
- 1.0.1 — 2022-02-09
- 1.0.0 — 2022-02-09
- 0.0.4 — 2022-02-08
- 0.0.3 — 2022-02-08
- 0.0.2 — 2022-02-08
- 0.0.1 — 2022-02-08

## README

# vite-plugin-vue2-jsx
Vite plugin for Vue2
* vue文件内自动识别转换<script lang="jsx">
* js文件自动识别转换jsx

## Install

```bash
npm install vite-plugin-vue2 -D
```

```js
// vite.config.js
import { createVuePlugin } from 'vite-plugin-vue2-jsx'

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

## [Options]

### `vueTemplateOptions`

Type: `Object`<br>

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

**Note {  whitespace: 'condense' } behavior**

* 如果元素标签之间的纯空格文本节点包含新行，则它会被删除。否则，它会被压缩成一个单一的空间。

* 非纯空格文本节点内的连续空格被压缩为一个空格。


使用压缩模式将导致更小的编译代码大小和稍微提高性能。但是，在某些情况下，与纯 HTML 相比，它会产生细微的视觉布局差异，如果要保留空白行为，请设置 `{ whitespace: 'preserve' }`

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

### `jsx`

Type: `Boolean`<br>
Default: `false`

jsx 转换的选项。

### `jsxOptions`

Type: `Object`<br>

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

### `target`

Type: `String`<br>

esbuild 转换脚本代码的选项

---
_Source: https://npm.io/package/vite-plugin-vue2-jsx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
