1.0.4 • Published 16 days ago
vite-plugin-change-jsx-factory v1.0.4
rollup-plugin-swap-module
A simple vite plugin to change the jsx factory of esbuild.
installation
npm install vite-plugin-change-jsx-factory -D
usage
To use this plugin with an already existing package that exports a createElement
function you should pass the package name to the plugin like this:
// vite.config.js
import { defineConfig } from 'vite';
import changeJSXFactory from 'vite-plugin-change-jsx-factory';
export default defineConfig({
// config options
plugins: [changeJSXFactory('your-package-name')],
});
or alternatively, you could create your own createElement
function and pass it to the plugin:
// vite.config.js
import { defineConfig } from 'vite';
import changeJSXFactory from 'vite-plugin-change-jsx-factory';
// see https://esbuild.github.io/api/#jsx-factory
function createElement(type, config, children){
...
}
export default defineConfig({
// config options
plugins: [changeJSXFactory(createElement)],
});