Skip to content

[docs-infra] Enable webpackBuildWorker to bound docs build memory#23100

Merged
Janpot merged 4 commits into
mui:masterfrom
Janpot:feat/docs-webpack-build-worker
Jul 8, 2026
Merged

[docs-infra] Enable webpackBuildWorker to bound docs build memory#23100
Janpot merged 4 commits into
mui:masterfrom
Janpot:feat/docs-webpack-build-worker

Conversation

@Janpot

@Janpot Janpot commented Jul 7, 2026

Copy link
Copy Markdown
Member

What

Enable experimental.webpackBuildWorker for the docs build, running each webpack
compilation in a separate, disposable worker process.

Why

The docs static export peaks near Netlify's ~11 GiB build limit and OOMs
intermittently. Profiling a full 717-page next build (per-process
memoryUsage() + getHeapSpaceStatistics()) showed the peak is webpack's
compilation working set — module graph on the V8 heap + source-map/cache
buffers — held in the single long-lived build process, not the generation worker.

webpackBuildWorker moves each compilation into a child that exits before static
generation, so that memory is reclaimed instead of accumulating. It's auto-off
when a custom webpack config is present, so the docs build needs it set
explicitly.

Build Peak RSS
Before ~10 GB
webpackBuildWorker: true ~4 GB

Identical 717-page output, build time unchanged. Numbers are a local macOS A/B;
the Netlify preview validates on the real builder.

Notes

@mui-bot

mui-bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy preview: https://deploy-preview-23100--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 24464e3

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23100--material-ui-x.netlify.app/
QR code for https://deploy-preview-23100--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 0B(0.00%) 0B(0.00%)
@mui/x-scheduler-premium 0B(0.00%) 0B(0.00%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@Janpot Janpot added scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). type: regression A bug, but worse, it used to behave as expected. labels Jul 7, 2026

@LukasTy LukasTy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the cleanest solution. 👍
Nice work. 👏

Comment thread docs/next.config.ts
// `false` when `config.webpack` is set), so it must be enabled explicitly.
// Cuts peak docs-build RSS from ~10 GB to ~4 GB, keeping it well under the
// Netlify build container limit that the static export was hitting.
webpackBuildWorker: true,

@brijeshb42 brijeshb42 Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should also add it in the base docs infra config as well so all projects benefit from it.

@Janpot Janpot Jul 8, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing it in mui/material-ui#48790. Merging in the meantime to unblock X.

@Janpot
Janpot marked this pull request as ready for review July 8, 2026 08:53
@Janpot
Janpot merged commit 70cfd37 into mui:master Jul 8, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). type: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants