Skip to main content

million

tip
npx million@latest # 自动 init

vite

import million from 'million/compiler';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [million.vite({ auto: true }), react()],
});

nextjs

import million from 'million/compiler';

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
};

const millionConfig = {
auto: true, // if you're using RSC: auto: { rsc: true },
};

export default million.next(nextConfig, millionConfig);

Rules

// Block 能被定义为变量

console.log(block(() => <div />)) // ❌ Wrong
export default block(() => <div />) // ❌ Wrong

// 👇👇👇

const Block = block(() => <div />) // ✅ Correct