Installation
Million.js assumes that you have an existing React project. To learn about how to create a React app, please see React's documentation (opens in a new tab).
Install via CLI
The Million.js CLI will automatically install the package and configure your project for you.
npx million@latest
Million.js is compatible with React 16 and above. If you're using an older version of React, you'll need to upgrade first.
That's it! Your project is now running on Million.js 🎉
Install manually
If you have issues installing via the CLI, or you have a custom setup, you can install Million.js manually.
Notice that there are two modes you can choose: Automatic and Manual:
-
Automatic mode will automatically configure, analyze, and optimize your project for you. This is the recommended mode.
-
Manual mode will require you to write code to optimize certain parts of your project. This mode is recommended for advanced users who want to have more control over their project.
Install Million.js
npm install million
Add the compiler to your application
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);