Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 1.07 KB

README.md

File metadata and controls

58 lines (41 loc) · 1.07 KB

vite-plugin-mitosis

npm

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.

Installation

# 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

Usage

SvelteKit

// 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';

License

MIT