1. rollup-plugin-vue-jsx-compat
work with [rollup-plugin-esbuild](https://github.com/egoist/rollup-plugin-esbuild), and just for vue-jsx
rollup-plugin-vue-jsx-compat
Package: rollup-plugin-vue-jsx-compat
Last modified: Mon, 16 May 2022 04:43:21 GMT
Version: 0.0.6
License: MIT
Downloads: 2,604

Install

npm install rollup-plugin-vue-jsx-compat
yarn add rollup-plugin-vue-jsx-compat

rollup-plugin-vue-jsx

work with rollup-plugin-esbuild, and just for vue-jsx

change foo.tsx

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

to

 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 to transform vue-jsx

how to use

 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

 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",
});

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin