Install Million.js
Million.js assumes that you've already initialized a React project. If you haven't, we recommend checking out react.dev (opens in a new tab) first.
If you're just looking to try out Million.js, check out the quickstart.
Million.js is compatible with React 18 and above. If you're using an older version of React, you'll need to upgrade first (opens in a new tab).
Install package
First things first, you'll need to install Million.js. You can do this with your favorite package manager:
npm install million
Use the compiler
Then, add the compiler to your build tool of choice:
Million.js is supported within the /app
("use client" components only) and /pages
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);
Ignoring components
If a certain component conficts with the Million.js runtime, it's possible to skip over them via the // million-ignore
comment.
// million-ignore
function App() {
return ...
}
Muting help messages
If you don't want to see the help messages, you can pass the { mute: true }
option to the compiler.