Migrate from bundlesize to size-limit#516
Conversation
Replace bundlesize with size-limit to resolve iltorb compilation issues. - Remove: bundlesize (depends on unmaintained iltorb) - Add: @size-limit/preset-small-lib and size-limit - Configure: Track 4 build outputs (umd.min, umd, es, cjs) with 3kB limits This follows the same pattern as react-final-form #1056. Part of OSS-28: Migrate all libraries from bundlesize to size-limit
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughReplaces Changes
Sequence Diagram(s)sequenceDiagram
participant GH as "GitHub Actions"
participant Runner as "Runner"
participant Repo as "Repository"
participant Node as "Node.js (22)"
participant Build as "Build (yarn)"
participant Size as "size-limit"
GH->>Runner: trigger workflow (push/PR)
Runner->>Repo: checkout (actions/checkout@v4)
Runner->>Node: setup Node.js 22 (actions/setup-node@v4)
Runner->>Repo: install deps (yarn --frozen-lockfile --ignore-scripts)
Runner->>Build: run yarn start build
Build-->>Runner: produce dist/ artifacts
Runner->>Size: run npx size-limit
Size-->>Runner: report pass/fail
Runner-->>GH: report job status
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@package.json`:
- Around line 104-120: Add execution of the size-limit check to CI so the
"size-limit" entries in package.json are enforced: update the CI workflow (e.g.,
.github/workflows/ci.yml) to run the size check by adding a new job or step that
runs `yarn size-limit` (or `npx size-limit`) after build/pack steps, or append
`yarn size-limit` to the existing validation/test job; ensure the step runs in
the same environment that has the built artifacts (so run after the build step)
and fails the job on non-zero exit so bundle size limits defined under
"size-limit" are enforced.
- Around line 68-70: The package.json declares engines.node as ">=8" which is
incompatible with [email protected] (requires ^18.0.0 || >=20.0.0); update the
engines.node field in package.json to ">=18" (or ">=18 || >=20" / "^18.0.0 ||
>=20.0.0") to match [email protected], or alternatively downgrade the
"size-limit" and "@size-limit/preset-small-lib" dependencies to a version that
supports Node 8; modify the "engines.node" entry accordingly and keep references
to "size-limit" and "@size-limit/preset-small-lib" consistent with the chosen
approach.
1. Update Node version requirement to >=18 (size-limit requires ^18.0.0 || >=20.0.0) 2. Add size-limit check to CI workflow - New 'size' job that builds and runs size-limit - Ensures bundle size limits are enforced in CI
✅ Addressed CodeRabbit feedback1. Node version requirement
2. CI enforcement
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Around line 58-62: Update the workflow to use the latest action versions and
remove the undefined matrix reference: replace actions/checkout@v2 with
actions/checkout@v4 and actions/setup-node@v2 with actions/setup-node@v4;
replace the step name that contains `${{ matrix.node_version }}` with a static
name like "Use Node.js 22" (or alternatively add a matrix.strategy.node_version
if you intend to run multiple versions) and ensure the setup-node step uses a
concrete node-version value (e.g., 22); apply the same changes to the lint,
prettier, test, and size jobs so they all reference actions/checkout and
actions/setup-node v4 and no undefined matrix variable in step names.
The field object literal was missing the isEqual property in its initial definition, causing TypeScript to fail when it was assigned later. Add isEqual: tripleEquals to the initial field object to match the InternalFieldState type. Fixes TypeScript compilation broken by #480.
Current bundle sizes (brotli compressed): - umd.min: ~6 kB (limit: 7kB with headroom) - umd: ~6 kB (limit: 7kB with headroom) - es: ~5.5 kB (limit: 6kB with headroom) - cjs: ~5.75 kB (limit: 6kB with headroom) Limits set with ~1kB headroom to catch regressions.
|
✅ CodeRabbit feedback addressed Fixed GitHub Actions workflow per your review:
CI re-running now! |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)
11-17: 🧹 Nitpick | 🔵 TrivialReduce CI drift by extracting the repeated setup steps.
The first three steps are identical across lint/prettier/test/size; consider YAML anchors or a reusable workflow to keep them in sync.
Also applies to: 26-32, 41-47, 58-65
🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Around line 63-64: Update the "Prepare env" step in the size GitHub Actions
job to add the missing --ignore-scripts flag so it matches the other jobs;
locate the step named "Prepare env" that currently runs yarn install
--frozen-lockfile and change it to include --ignore-scripts to prevent
package.json lifecycle scripts (e.g., prepare) from running during the size job.
|
✅ CodeRabbit feedback addressed Added Commit 8ae7bf4. Ready for re-review! |
Resolved yarn.lock conflict by accepting upstream changes.
024717d
8ae7bf4 to
024717d
Compare
|
✅ Merge conflict resolved. Merged latest main and resolved yarn.lock conflict. |
Problem
bundlesizedepends oniltorbwhich fails to compile on modern Node versions and is no longer maintained.Solution
Replace with
size-limitwhich is actively maintained and doesn't have native dependencies.Changes
bundlesize(depends on unmaintainediltorb)@size-limit/preset-small-libandsize-limitdist/final-form.umd.min.jsdist/final-form.umd.jsdist/final-form.es.jsdist/final-form.cjs.jsFollows
Same pattern as react-final-form #1056
Part of
🎯 OSS-28: Migrate all libraries from bundlesize to size-limit
Summary by CodeRabbit
Chores
Bug Fixes