Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Latest commit

 

History

History
51 lines (36 loc) · 1.28 KB

README.md

File metadata and controls

51 lines (36 loc) · 1.28 KB

Merged into Million repository

vite-plugin-million

⚡ Million.js' compiler powered by Vite.js.

Generate raw objects instead of virtual node h calls.

Please note that this is not a full replacement of million/jsx-runtime. It only supports basic children normalization, flag resolution. It does not support the kebab, className, style, or delta helpers or JSX automatic runtime.

With vite-plugin-million: <div>Hello World</div>{ tag: 'div', props: null, children: ['Hello World'] }

Without vite-plugin-million: <div>Hello World</div>h('div', null, 'Hello World')

Install

npm install --save-dev vite-plugin-million

vite.config.ts

import { defineConfig } from 'vite';
import million from 'vite-plugin-million';

export default defineConfig({
  esbuild: {
    jsxFactory: 'h',
    jsxFragment: 'Fragment',
    jsxInject: `import { h, jsxs, Fragment } from 'million/jsx-runtime'`,
  },
  plugins: [million()],
});

tsconfig.json

{
  "compilerOptions": {
    "moduleResolution": "node",
    "jsx": "react-jsx",
    "jsxImportSource": "million"
  }
}

License

vite-plugin-million is MIT-licensed open-source software by Aiden Bai.