vite-plugin-jsx-sfc
v1.7.0
Published
Vite plugin for compile and enhance the limitation of jsx-sfc runtime code.
Downloads
35
Readme
vite-plugin-jsx-sfc
Vite plugin for compile and enhance the limitation of jsx-sfc
runtime code.
Usage
npm install jsx-sfc vite-plugin-jsx-sfc
- Configure Vite(v2.x with
@vitejs/plugin-react
):
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import jsxSfc from 'vite-plugin-jsx-sfc';
export default defineConfig({
plugins: [jsxSfc({ transformJsx: false }), react()]
});
- Configure Vite(v2.x with
@vitejs/plugin-react-refresh
):
import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import jsxSfc from 'vite-plugin-jsx-sfc';
export default defineConfig({
plugins: [jsxSfc(), reactRefresh()]
});
- Configure Vite(v1.x):
// vite.config.js
import reactPlugin from 'vite-plugin-react';
import sfcPlugin from 'vite-plugin-jsx-sfc/legacy';
const config = {
...
plugins: [sfcPlugin, reactPlugin]
}
License
MIT