chore: migrate to monosize v0.10 and add scoped bundle-size threshold - #36499
Open
Hotell wants to merge 1 commit into
Open
chore: migrate to monosize v0.10 and add scoped bundle-size threshold#36499Hotell wants to merge 1 commit into
Hotell wants to merge 1 commit into
Conversation
📊 Bundle size report✅ No changes found |
Hotell
force-pushed
the
feat/monosize-v0.10-migration
branch
from
August 3, 2026 16:37
a51419e to
103075e
Compare
|
Pull request demo site: URL |
Bumps monosize 0.9.0 -> 0.10.0 with its two adapters, and uses the headline 0.10 feature (per-package thresholds resolved at measure time) to give react-headless-components-preview a scoped 10kB budget. Pins webpack for the bundler adapter. monosize-bundler-webpack@0.4.1 widened its range to webpack@^5.108.3, a descriptor not previously in the lockfile, so yarn resolved it fresh to 5.109.2 instead of reusing the repo's 5.108.4. webpack 5.109 flips experiments.typescript from undefined to "auto", which self-enables whenever Node exposes module.stripTypeScriptTypes and no .ts rule is registered -- true for the monosize config, which declares no module.rules. That sets resolve.tsconfig = true, so tsconfig paths redirect @fluentui/* imports into src/, where .tsx is absent from the TS-enabled extension list and resolution fails. Every fixture broke. Fixing this in the bundler enhancer instead was tried and rejected: the global-context and react configs replace `bundler` wholesale rather than merging it, so a root-level opt-out silently does not reach them. Also ignores monosize.config.mjs in beachball, matching the existing **/bundle-size/** entry, so build-tooling config does not drive releases.
Hotell
force-pushed
the
feat/monosize-v0.10-migration
branch
from
August 4, 2026 10:59
103075e to
d3aef75
Compare
Hotell
marked this pull request as ready for review
August 4, 2026 11:16
Hotell
commented
Aug 4, 2026
| /** @type {import('monosize').MonoSizeConfig} */ | ||
| const monosizeConfig = { | ||
| ...baseConfig, | ||
| threshold: '10kB', |
Contributor
Author
There was a problem hiding this comment.
should we stay with 10kb (default) or leave default 10% ? I'd tighten this down maybe to 5% to have very low breathing room when increasing. when we introduce new control that will be admin merged only after proper review/approvals . wdyt @dmytrokirpa
Contributor
There was a problem hiding this comment.
Anything up to ~20kb (Griffel) should be fine. I’d rather use an absolute number than a percentage, since it will grow over time
mainframev
approved these changes
Aug 5, 2026
dmytrokirpa
approved these changes
Aug 5, 2026
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.
Previous Behavior
monosizepinned at0.9.0. Bundle-size thresholds were global-only, so a single package couldn't get its own budget without re-budgeting all 235 fixtures.react-headless-components-previewwas gated by the default10%.New Behavior
Bumps
monosize0.9.0→0.10.0plus both adapters (monosize-bundler-webpack0.4.0→0.4.1,monosize-storage-git0.3.4→0.3.5). All three move together — the adapters requiremonosize: ^0.10.0.Uses the 0.10 feature — per-package thresholds baked into the report at measure time — to give
react-headless-components-previewa scoped10kBbudget via a newlibrary/monosize.config.mjs. No other fixture is affected.Why the webpack resolution
monosize-bundler-webpack@0.4.1widened its range towebpack@^5.108.3. That descriptor wasn't in the lockfile, so yarn resolved it fresh to5.109.2instead of reusing the repo's pinned5.108.4.webpack 5.109 flips
experiments.typescriptfromundefinedto"auto", which self-enables when Node hasmodule.stripTypeScriptTypesand no.tsloader is registered — true for the monosize config, which declares nomodule.rules. That setsresolve.tsconfig = true, so tsconfigpathsredirect@fluentui/*intosrc/, where.tsxis absent from the TS-enabled extension list. Every fixture broke."monosize-bundler-webpack/webpack": "5.108.4"keeps the adapter on the known-good version without constraining webpack elsewhere. Verifiedyarn dedupe --strategy highestcan't move it.Alternative considered and rejected
Setting
experiments: { typescript: false }in the rootmonosize.config.mjsenhancer fixes the root cause, butpackages/reactandglobal-contextreplacebundlerwholesale rather than merging it, so the opt-out never reaches them —global-context:bundle-sizestill failed a full sweep.Beachball
Adds
**/monosize.config.mjstoignorePatterns(matching the existing**/bundle-size/**) so build tooling doesn't drive releases; without it the new file flags@fluentui/react-headless-components-previewfor a version bump.Verification
nx run-many -t bundle-size --nxBail→ 60 projects, 99 dependent tasks, all greenreact-headless-components-previewreport carries"threshold": { "size": 10240, "type": "size" };react-spinner's has none — scoping confirmedreact:bundle-sizeandglobal-context:bundle-size(existing per-package configs) still passyarn why monosize→ single resolution at0.10.0, no nested webpackyarn check:change→ no change files neededcompare-reportsneedsGITHUB_TOKEN+ a master base ref, so it's only verifiable on the PR comment.Notes for reviewers
10%untilbundle-size-base.ymlre-runs on master under 0.10.10kBis ~2.5× tighter than the default, not looser — the fixture is251.914 kBminified, so10%would be ~25.2 kB. For calibration, fix: Escape in an open Combobox or Dropdown does not trigger tabster actions #36275 grew this fixture by+37.043 kB(+18.7%); the new budget would have blocked it. (thresholdfirst shipped in monosize 0.9.0 — the repo was on 0.6.3 back then, so nothing gated it.)parseThresholdtreatskBas 1024 bytes while the report renders 1000-based kB, so'10kB'gates at a displayed ~10.24 kB.apps/public-docsite,apps/ssr-testsandapps/theming-designerall break (they extendtsconfig.base.v8.json, which carries thesrcpath mappings). v8 package bundles survive — their tsconfigs are standalone with nopaths. One line increateConfig()would cover all three. Separately,public-docsiteandssr-testsexit 0 despite 100 module build errors each and emit a truncated bundle — a pre-existing error-propagation gap in the just-scripts webpack task that's worth fixing before any webpack bump.Related Issue(s)