Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

perf(dev): run dev/build at low priority, load docs MDX lazily

kapishdima8d053008d75b
diff --git a/app/docs/[[...slug]]/page.tsx b/app/docs/[[...slug]]/page.tsx
index 2c0a4163..6bb59200 100644
--- a/app/docs/[[...slug]]/page.tsx
+++ b/app/docs/[[...slug]]/page.tsx
@@ -23,7 +23,7 @@ export default async function Page(props: {
if (!page) notFound();
const data = page.data;
- const MDX = data.body;
+ const { body: MDX } = await data.load();
const { crumbs, previous, next } = getPageContext(page.url);
const links = params.slug?.length ? getPageLinks(page.url) : undefined;
const raw = await (
diff --git a/content/docs/guides/feature-announcement.mdx b/content/docs/guides/feature-announcement.mdx
index 49bb6ae7..b2a32353 100644
--- a/content/docs/guides/feature-announcement.mdx
+++ b/content/docs/guides/feature-announcement.mdx
@@ -4,6 +4,7 @@ navTitle: Feature announcement
description: "How to make a feature announcement video without a video editor: Claude Code or Codex builds a ~40-second release video from your release notes and Remocn's Remotion components, with no timeline, rendered to MP4 on your machine. Prompts, storyboard, timings and a comparison with Loom, Screen Studio, Descript, HeyGen and Canva."
---
+import { Faq } from "@/components/docs/index/introduction/faq";
import { GuideNotes, GuideMoreLink } from "@/components/docs/guides/director-notes";
import { GuideCount } from "@/components/docs/guides/guide-ui";
import { GuideNote } from "@/components/docs/guides/note";
diff --git a/package.json b/package.json
index 313386cd..5ea2905e 100644
--- a/package.json
+++ b/package.json
@@ -18,10 +18,10 @@
"studio:launch-anything": "remotion studio src/remotion/launch-anything-root.tsx",
"render:launch-anything": "bun scripts/render-launch-anything.mts",
"review:launch-anything": "bun scripts/review-launch-anything.mts",
- "dev": "next dev",
- "dev:clean": "rm -rf .next && next dev",
+ "dev": "bun scripts/low-priority.mts next dev",
+ "dev:clean": "rm -rf .next && bun scripts/low-priority.mts next dev",
"clean": "rm -rf .next",
- "build": "NODE_OPTIONS=--max-old-space-size=8192 next build",
+ "build": "NODE_OPTIONS=--max-old-space-size=8192 bun scripts/low-priority.mts next build",
"start": "next start",
"test": "bun test",
"typecheck": "tsc --noEmit",
diff --git a/scripts/low-priority.mts b/scripts/low-priority.mts
new file mode 100644
index 00000000..dfb74d3e
--- /dev/null
+++ b/scripts/low-priority.mts
@@ -0,0 +1,33 @@
+// Runs a command below normal CPU priority, so the editor and browser stay
+// responsive while Turbopack compiles. On macOS the utility QoS class keeps
+// performance cores free for foreground apps at nearly the same compile
+// speed (`-b`, background, confines it to efficiency cores and is ~6x slower).
+//
+// bun scripts/low-priority.mts next dev
+import { spawn } from "node:child_process";
+
+const command = process.argv.slice(2);
+if (command.length === 0) {
+ console.error("usage: bun scripts/low-priority.mts <command> [...args]");
+ process.exit(1);
+}
+
+const [bin, ...args] =
+ process.platform === "darwin"
+ ? ["taskpolicy", "-c", "utility", ...command]
+ : process.platform === "linux"
+ ? ["nice", "-n", "10", ...command]
+ : command;
+
+const child = spawn(bin, args, { stdio: "inherit" });
+
+// Ctrl+C already reaches the child through the terminal's process group;
+// forward the rest so `kill` on this wrapper stops the server too.
+for (const signal of ["SIGTERM", "SIGHUP"] as const) {
+ process.on(signal, () => child.kill(signal));
+}
+process.on("SIGINT", () => {});
+
+child.on("exit", (code, signal) => {
+ process.exit(code ?? (signal ? 1 : 0));
+});
diff --git a/source.config.ts b/source.config.ts
index 03b70f1a..04e0c7a0 100644
--- a/source.config.ts
+++ b/source.config.ts
@@ -12,6 +12,9 @@ import { componentMetaSchema } from "./lib/docs-schema";
export const docs = defineDocs({
dir: "content/docs",
docs: {
+ // ~1000 pages: load each body on demand instead of compiling all of them
+ // into the docs route on its first request.
+ async: true,
schema: pageSchema.safeExtend({
...componentMetaSchema.shape,
// Shorter label for the sidebar, breadcrumbs and prev/next when the