Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aidenybai/vite-plugin-million
⚡ Million.js' compiler powered by Vite.js
https://github.com/aidenybai/vite-plugin-million
jsx million millionjs vite
Last synced: 3 months ago
JSON representation
⚡ Million.js' compiler powered by Vite.js
- Host: GitHub
- URL: https://github.com/aidenybai/vite-plugin-million
- Owner: aidenybai
- Archived: true
- Created: 2021-12-29T08:59:37.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-31T16:04:47.000Z (over 2 years ago)
- Last Synced: 2024-09-04T08:23:32.834Z (4 months ago)
- Topics: jsx, million, millionjs, vite
- Language: TypeScript
- Homepage:
- Size: 34.2 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> Merged into [Million repository](https://github.com/aidenybai/million)
# 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`:** `
Hello World` → `{ tag: 'div', props: null, children: ['Hello World'] }`**Without `vite-plugin-million`:** `
Hello World` → `h('div', null, 'Hello World')`## Install
```sh
npm install --save-dev vite-plugin-million
````vite.config.ts`
```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`
```json
{
"compilerOptions": {
"moduleResolution": "node",
"jsx": "react-jsx",
"jsxImportSource": "million"
}
}
```## License
vite-plugin-million is [MIT-licensed](LICENSE) open-source software by [Aiden Bai](https://github.com/aidenybai).