Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(docsite): bound Webpack build memory (#9228)

Cindy Zhangfdabeba1aed0
diff --git a/apps/docsite/next.config.mjs b/apps/docsite/next.config.mjs
index de34c14a3b..2f0c74d7ea 100644
--- a/apps/docsite/next.config.mjs
+++ b/apps/docsite/next.config.mjs
@@ -1,11 +1,13 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
/**
- * @file Configure the docsite's routes, response headers, and theme resolution.
+ * @file Configure docsite routes, response headers, theme resolution, and build
+ * memory.
* @input Next.js build configuration, the early playground cookie guard, and
* staged preview-only static exports.
* @output Docsite routes plus Storybook and Sandbox at /storybook/ and /sandbox/.
- * Client main-app chunks start with the preview's cookie compatibility guard.
+ * Client main-app chunks start with the preview's cookie compatibility guard;
+ * large Webpack builds run with isolated, memory-optimized compilation.
* @position Next.js configuration for the existing Vercel docsite deployment.
*/
@@ -38,6 +40,13 @@ const stagesStaticApps =
/** @type {import('next').NextConfig} */
const nextConfig = {
cacheComponents: true,
+ // The custom Webpack hook below disables Next's default build worker. The
+ // canary docsite compiles the live workspace, so keep that compilation in a
+ // separate process and use Next's low-risk peak-memory optimization.
+ experimental: {
+ webpackBuildWorker: true,
+ webpackMemoryOptimizations: true,
+ },
// The search API (app/api/search) runs `astryx search` itself. The CLI stays
// an external module (see webpack below), so its code and dependencies are
// traced as installed; these are the files it reads from disk at run time: