Skip to content

[docs-infra] Update docs to support turbopack mode#4888

Open
brijeshb42 wants to merge 2 commits into
mui:masterfrom
brijeshb42:turbopack
Open

[docs-infra] Update docs to support turbopack mode#4888
brijeshb42 wants to merge 2 commits into
mui:masterfrom
brijeshb42:turbopack

Conversation

@brijeshb42
Copy link
Copy Markdown
Contributor

@brijeshb42 brijeshb42 commented May 22, 2026

TL;DR

  • Dev startup: ~3× faster (1.0s → 0.35s)
  • Cold-route compile: ~1.4× faster on average (5.87s → 4.26s across 4 routes); per-route range from 0.8× to 2.0×. Still dominated by loadPrecomputedTypes (1–2s per types.ts) in both modes. We need to improve this on the docs-infra package side.
  • HMR rebuilds: ~2.8× faster (1.77s → 0.63s mean across 3 edit targets)
  • Production build: 2.3× faster (61.5s → 27.0s), 2.7× less CPU
  1. Dev server startup (cold, after rm -rf .next)
webpack Turbopack
Ready in 1.32–1.51s 0.34–0.53s

~3× faster ready time.

  1. First-request compile per route (no cache)
route webpack Turbopack
/ 1.9s 1.4s
/react/components/popover 6.1s* 5.1s
/react/components/dialog 4.2s 2.0s
/react/components/select 2.5s 3.7s
/react/components/combobox 3.5s 2.7s
  1. HMR / incremental recompile (3 edit cycles × 2 add+revert)
file edited webpack Turbopack speedup
popover/page.mdx 1.86s 0.48s 3.9×
PopoverPopup.tsx (workspace pkg) 2.50s 0.95s 2.6×
docs CodeBlock.tsx 0.95s 0.45s 2.1×
mean 1.77s 0.63s 2.8×
  1. Production build (cold, rm -rf .next export)
wall user CPU
webpack 61.5s 128.3s
Turbopack 27.0s 47.5s
ratio 2.3× faster 2.7× less CPU

@dav-is When building the docs, I got a bunch of -

Unable to handle a type with flag "IncludesInstantiable". Using any instead.

Also, I need you to check if everything is working as far as docs-infra related transforms are concerned since you have larger context. I have already verified that a bunch of pages are working as expected.

@brijeshb42 brijeshb42 requested review from a team and dav-is May 22, 2026 10:52
@brijeshb42 brijeshb42 requested review from atomiks and romgrk as code owners May 22, 2026 10:52
@brijeshb42 brijeshb42 added the scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). label May 22, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 22, 2026

commit: 8216949

@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 22, 2026

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 1,200.00 ms -49.01 ms(-3.9%) | Renders: 50 (+0) | Paint: 1,830.19 ms -65.20 ms(-3.4%)

Test Duration Renders
Checkbox mount (500 instances) 87.75 ms 🔺+15.93 ms(+22.2%) 1 (+0)
Slider mount (300 instances) 157.77 ms ▼-44.01 ms(-21.8%) 3 (+0)

10 tests within noise — details


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

@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2026

Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 8216949
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a103c0e1363e40008fdedf4
😎 Deploy Preview https://deploy-preview-4888--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.


const EAGER_COUNT = 2;

export function rehypeEagerCodeBlocks() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Default exports are read through string based plugin paths.

"#test-utils": "./test/index.ts",
"#formatErrorMessage": "@base-ui/utils/formatErrorMessage"
},
"type": "commonjs",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Explicit type to commonjs leads turbopack to fail with error -

./packages/utils/src/warn.ts
Specified module format (CommonJs) is not matching the module format of the source code (EcmaScript Modules)
The CommonJs module format was specified in the package.json that is affecting this source file or by using an special extension, but Ecmascript import/export syntax is used in the source code.
The module was automatically converted to an EcmaScript module, but that is in conflict with the specified module format. Either change the "type" field in the package.json or replace EcmaScript import/export syntax with CommonJs syntas in the source file.

So we can either omit the field (as in PR) or add a nested package.json inside src stating type: module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant