# rollup-plugin-vue-jsx-compat

> work with [rollup-plugin-esbuild](https://github.com/egoist/rollup-plugin-esbuild)， and just for vue-jsx

Latest version **0.0.6** (published 2021-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-vue-jsx-compat
pnpm add rollup-plugin-vue-jsx-compat
yarn add rollup-plugin-vue-jsx-compat
bun add rollup-plugin-vue-jsx-compat
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2021-06-11 |
| First published | 2020-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 16 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | xiangxiao |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-vue-jsx-compat
- npm.io page: https://npm.io/package/rollup-plugin-vue-jsx-compat

## Dependencies (1)

- [@rollup/pluginutils](https://npm.io/package/@rollup/pluginutils.md) ^4.0.0

## Recent versions

- 0.0.6 (latest) — 2021-06-11
- 0.0.5 — 2021-06-07
- 0.0.4 — 2021-06-07
- 0.0.2 — 2020-09-21
- 0.0.1 — 2020-09-21

## README

# rollup-plugin-vue-jsx

work with [rollup-plugin-esbuild](https://github.com/egoist/rollup-plugin-esbuild)， and just for vue-jsx

change `foo.tsx`

```js
export default class Foo {
  render() {
    return <div className="hehe">hello there!!!</div>;
  }
}
```

to

```js
import { createVNode, isVNode } from "vue";

const slice = Array.prototype.slice;
function vueJsxCompat(tag, props = null, children = null) {
  if (arguments.length > 3 || isVNode(children)) {
    children = slice.call(arguments, 2);
  }
  return createVNode(tag, props, children);
}

class Foo {
  render() {
    return /* @__PURE__ */ vueJsxCompat(
      "div",
      {
        className: "hehe",
      },
      "hello there!!!"
    );
  }
}
```

add [vue-jsx-compat](https://github.com/xxholly32/rollup-plugin-vue-jsx/blob/master/src/vue-jsx-compat.js) to transform vue-jsx

## how to use

```js
import vueJsx from "rollup-plugin-vue-jsx-compat"
import esbuild from "rollup-plugin-esbuild";

export default {
  ...
  plugins: [
    vueJsx(),
    esbuild({
      jsxFactory: "vueJsxCompat",
    }),
  ],
};
```

or you can add your config

```js
vueJsx({
  // it only use same function name with esbuild
  jsxFactory: "vueJsxCompat",
  // if you not use default vus-jsx-transformer, you write your own file path in here
  path: "you file path",
});
```

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