Documentation
Virtual DOM
Optimizing compiler

Optimizing Compiler

💡

This is an experimental feature. It is not recommended to use this in production. The compiler is currently only tailored for Million core, do not use with React.

Million.js has an optimizing compiler that can be used to optimize block initialization. It current supports Vite (opens in a new tab), Webpack (opens in a new tab), Rollup (opens in a new tab), and ESBuild (opens in a new tab) through unplugin (opens in a new tab).

You can import based on needs like so:

import { vite, webpack, rollup, esbuild } from 'million/compiler';

Vite

// vite.config.js
import * as million from 'million/compiler';
import { defineConfig } from 'vite';
 
export default defineConfig({
  plugins: [million.vite()],
});

Webpack

// webpack.config.js
import * as million from 'million/compiler';
 
export default {
  plugins: [million.webpack()],
};

Rollup

// rollup.config.js
import * as million from 'million/compiler';
 
export default {
  plugins: [million.rollup()],
};

ESBuild

// esbuild.config.js
import { build } from 'esbuild';
import * as million from 'million/compiler';
 
build({
  plugins: [million.esbuild()],
});