Using Million.js with Remix: A Workaround

Using Million.js with Remix: A Workaround
⌛
This blog post, originally drafted around 2023-12-18, is obsolete because both Million.js and Remix have been sunsetted. Over time, both projects evolved. Remix announced that much of its work is being brought into React Router v7, and Million.js pivoted more towards “Million Lint” and tooling around performance rather than purely its original runtime. Read about Million.js in Wayback Machine (even older snapshot, later transitioned to Lint) and Remix.
Update

If you are looking to improve the performance of any React project in 2025, I recommend using React Compiler.

Learn more

Remix is a full‑stack framework that leans heavily on web standards and streamlined data flows to boost speed and developer productivity. Million.js is a React‑centric compiler/runtime tool built to accelerate rendering by optimizing the virtual DOM and component updates. When you look at Remix and Million.js side by side, you see two tools that share a clear goal: making the web faster by simplifying backend logic and enhancing frontend performance. Yet despite this overlap in goals, they don’t play nicely out of the box.

There’s an issue on GitHub documenting this, with the main concern being that Remix does not have support for 3rd-party custom plugins to alter its build process:

Add compatibility with Gatsby, Remix, etc. · Issue #322 · aidenybai/million
As the title suggested, can this be used in a Gatsby project?

This design is intentional. The team wants to abstract away much of the build configuration for simplicity and to encourage standards.

Although Remix does not expose a plugins API, there is actually a way to make them work together. You see, Million.js exports an ESBuild plugin:

million/packages/compiler/index.ts at 4450abd467e76884aa48c91a62420b20d8d6646e · aidenybai/million
Make React Faster. Automatically. Contribute to aidenybai/million development by creating an account on GitHub.

And using a tool called remix-esbuild-override, we can actually inject ESBuild plugins into the Remix build process:

[Removed]

Your remix.config.js should look like:

[Removed]

I have tested this setup in my personal projects and it works fine.