Vite plugin to import JSX components to different UI frameworks using mitosis.
Warning
Currently, this is a Proof-of-Concept. It only works with Mitosis JSX to Svelte for now.
# npm
npm install --save-dev vite-plugin-mitosis
# yarn
yarn add -D vite-plugin-mitosis
# pnpm
pnpm add -D vite-plugin-mitosis
# bun
bun add -D vite-plugin-mitosis
// vite.config.js
import { defineConfig } from 'vite';
import { svelteKit } from '@sveltejs/kit/vite';
import mitosis from 'vite-plugin-mitosis';
export default defineConfig({
// ...
plugins: [mitosis(), sveltekit()],
// ^ should go before sveltekit
});
// svelte.config.js
const config = {
extensions: ['.svelte', '.jsx', '.tsx'],
};
Then JSX components can be imported as is:
import Button from '$lib/components/Button.jsx';