[docs-infra] Support turbopack for docs#48569
Open
brijeshb42 wants to merge 6 commits into
Open
Conversation
…ranslation Collapse the helper to operate on a single raw translation object. The caller no longer wraps in a require.context shim or a per-language map; it just passes the imported English JSON. The function mutates and returns the translation with `componentDescription` rendered to HTML and `componentDescriptionToc` populated. Breaking change for downstream consumers (mui-x). Coordinate the @mui/internal-core-docs publish with PR 3+4 once mui-x has migrated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Update the ComponentApiBuilder template to statically import the
English translation JSON and call mapApiPageTranslation directly. The
{ en: ... } wrapper is constructed at the call site since ApiPage still
indexes descriptions by language. Webpack's require.context is gone and
the runtime markdown renderer stays out of the API page client bundle
because Next strips the import along with getStaticProps.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Bundler benchmark: webpack vs turbopack - Host: Brijeshs-MacBook-Pro.local (darwin arm64, 14 cores, 38.7 GB RAM) - Node: v24.14.0 - Next.js: 16.2.6 - Date: 2026-05-25 - Runs per metric: 10 (HMR: + 2 warmup discarded) - Component page: `/material-ui/react-button/` - HMR edit target: `docs/data/material/components/buttons/BasicButtons.js`. First `>WORD<` JSX text child rewritten to a fresh marker each run (cascade, no reset between runs). - HMR timing: `writeFile` → first `[Fast Refresh] done in Xms` console event seen in a headless Chrome tab (Playwright). ## Summary | Metric | webpack (mean) | turbopack (mean) | turbopack vs webpack | |---|---:|---:|---:| | Cold prod build | 98.43 s | 36.03 s | **2.73× faster** | | Dev startup (process boot → `Ready in`) | 408 ms | 368 ms | 1.11× faster | | Home `/` cold first-load | 5.68 s | 4.77 s | 1.19× faster | | Component cold first-load | 2.06 s | 1.32 s | **1.56× faster** | | HMR — driver wall clock (edit → event) | 416 ms | 282 ms | **1.47× faster** | | HMR — bundler-reported (`Fast Refresh done in Xms`) | 402 ms | 111 ms | **3.64× faster** | ### Cold prod build (`next build`) | bundler | n | mean | stddev | min | median | p95 | max | |---|---:|---:|---:|---:|---:|---:|---:| | webpack | 10 | 98.43 s | 4.06 s | 93.40 s | 97.25 s | 108.51 s | 108.51 s | | turbopack | 10 | 36.03 s | 2.51 s | 32.16 s | 36.34 s | 39.20 s | 39.20 s | _turbopack mean **2.73× faster** than webpack._ <details><summary>raw samples (ms)</summary> - **webpack**: `97644, 96750, 93396, 101528, 108506, 97228, 96482, 97265, 97160, 98348` - **turbopack**: `32157, 32827, 33746, 35170, 35528, 37154, 37905, 38132, 38482, 39204` </details> ### Dev startup (process boot → `Ready in`) | bundler | n | mean | stddev | min | median | p95 | max | |---|---:|---:|---:|---:|---:|---:|---:| | webpack | 10 | 408 ms | 90 ms | 350 ms | 372 ms | 642 ms | 642 ms | | turbopack | 10 | 368 ms | 15 ms | 354 ms | 367 ms | 403 ms | 403 ms | _turbopack mean **1.11× faster** than webpack._ <details><summary>raw samples (ms)</summary> - **webpack**: `642, 382, 464, 434, 356, 383, 359, 350, 362, 352` - **turbopack**: `362, 403, 371, 358, 356, 382, 356, 371, 354, 371` </details> ### Home `/` cold first-load | bundler | n | mean | stddev | min | median | p95 | max | |---|---:|---:|---:|---:|---:|---:|---:| | webpack | 10 | 5.68 s | 1.69 s | 4.74 s | 5.11 s | 10.41 s | 10.41 s | | turbopack | 10 | 4.77 s | 151 ms | 4.54 s | 4.74 s | 5.05 s | 5.05 s | _turbopack mean **1.19× faster** than webpack._ <details><summary>raw samples (ms)</summary> - **webpack**: `10412, 5940, 5449, 4992, 5071, 4966, 5139, 4927, 4737, 5198` - **turbopack**: `4728, 4873, 5054, 4847, 4695, 4542, 4882, 4753, 4594, 4704` </details> ### Component `/material-ui/react-button/` cold first-load | bundler | n | mean | stddev | min | median | p95 | max | |---|---:|---:|---:|---:|---:|---:|---:| | webpack | 10 | 2.06 s | 742 ms | 1.68 s | 1.74 s | 3.85 s | 3.85 s | | turbopack | 10 | 1.32 s | 41 ms | 1.27 s | 1.32 s | 1.39 s | 1.39 s | _turbopack mean **1.56× faster** than webpack._ <details><summary>raw samples (ms)</summary> - **webpack**: `3849, 2973, 1775, 1749, 1680, 1685, 1726, 1710, 1690, 1764` - **turbopack**: `1277, 1385, 1315, 1326, 1289, 1266, 1350, 1349, 1375, 1295` </details> ### HMR — edit → `[Fast Refresh] done` (driver wall clock) Real HMR via Playwright: edit demo file, observe the next `[Fast Refresh] done` console event in the open browser tab. | bundler | n | mean | stddev | min | median | p95 | max | |---|---:|---:|---:|---:|---:|---:|---:| | webpack | 10 | 416 ms | 48 ms | 341 ms | 421 ms | 482 ms | 482 ms | | turbopack | 10 | 282 ms | 57 ms | 212 ms | 290 ms | 358 ms | 358 ms | _turbopack mean **1.47× faster** than webpack._ <details><summary>raw samples (ms)</summary> - **webpack**: `453, 396, 448, 382, 446, 366, 482, 381, 463, 341` - **turbopack**: `358, 212, 319, 215, 328, 230, 336, 236, 329, 260` </details> ### HMR — bundler-reported (`[Fast Refresh] done in Xms`) Parses the `Xms` value printed by Next's Fast Refresh runtime — bundler-side recompile only, excludes WS round-trip and Playwright console plumbing. | bundler | n | mean | stddev | min | median | p95 | max | |---|---:|---:|---:|---:|---:|---:|---:| | webpack | 10 | 402 ms | 48 ms | 327 ms | 408 ms | 469 ms | 469 ms | | turbopack | 10 | 111 ms | 75 ms | 71 ms | 87 ms | 320 ms | 320 ms | _turbopack mean **3.64× faster** than webpack._ <details><summary>raw samples (ms)</summary> - **webpack**: `440, 382, 435, 369, 433, 353, 469, 366, 449, 327` - **turbopack**: `99, 74, 71, 77, 82, 91, 320, 99, 71, 121` </details>
Deploy previewhttps://deploy-preview-48569--material-ui.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A followup to #48370
Only the latest commit is of this PR. Others are from the above PR.
Bundler benchmark: webpack vs turbopack
/material-ui/react-button/docs/data/material/components/buttons/BasicButtons.js. First>WORD<JSX text child rewritten to a fresh marker each run (cascade, no reset between runs).writeFile→ first[Fast Refresh] done in Xmsconsole event seen in a headless Chrome tab (Playwright).Summary
Ready in)/cold first-loadFast Refresh done in Xms)Cold prod build (
next build)turbopack mean 2.73× faster than webpack.
raw samples (ms)
97644, 96750, 93396, 101528, 108506, 97228, 96482, 97265, 97160, 9834832157, 32827, 33746, 35170, 35528, 37154, 37905, 38132, 38482, 39204Dev startup (process boot →
Ready in)turbopack mean 1.11× faster than webpack.
raw samples (ms)
642, 382, 464, 434, 356, 383, 359, 350, 362, 352362, 403, 371, 358, 356, 382, 356, 371, 354, 371Home
/cold first-loadturbopack mean 1.19× faster than webpack.
raw samples (ms)
10412, 5940, 5449, 4992, 5071, 4966, 5139, 4927, 4737, 51984728, 4873, 5054, 4847, 4695, 4542, 4882, 4753, 4594, 4704Component
/material-ui/react-button/cold first-loadturbopack mean 1.56× faster than webpack.
raw samples (ms)
3849, 2973, 1775, 1749, 1680, 1685, 1726, 1710, 1690, 17641277, 1385, 1315, 1326, 1289, 1266, 1350, 1349, 1375, 1295HMR — edit →
[Fast Refresh] done(driver wall clock)Real HMR via Playwright: edit demo file, observe the next
[Fast Refresh] doneconsole event in the open browser tab.turbopack mean 1.47× faster than webpack.
raw samples (ms)
453, 396, 448, 382, 446, 366, 482, 381, 463, 341358, 212, 319, 215, 328, 230, 336, 236, 329, 260HMR — bundler-reported (
[Fast Refresh] done in Xms)Parses the
Xmsvalue printed by Next's Fast Refresh runtime — bundler-side recompile only, excludes WS round-trip and Playwright console plumbing.turbopack mean 3.64× faster than webpack.
raw samples (ms)
440, 382, 435, 369, 433, 353, 469, 366, 449, 32799, 74, 71, 77, 82, 91, 320, 99, 71, 121