vite-plugin-jsx-sfc

1.6.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i vite-plugin-jsx-sfc

Weekly Downloads

2

Version

1.6.1

License

MIT

Unpacked Size

9.03 kB

Total Files

8

Last publish

Collaborators

  • joe_sky