Skip to content

ci(codecov): webpack bundle-stats job#540

Closed
ng wants to merge 4 commits into
devfrom
ci/codecov-bundle-stats
Closed

ci(codecov): webpack bundle-stats job#540
ng wants to merge 4 commits into
devfrom
ci/codecov-bundle-stats

Conversation

@ng

@ng ng commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Next.js 16 defaults to Turbopack, which skips the webpack() hook in next.config.mjs, so @codecov/nextjs-webpack-plugin never runs during the deploy build (verified on commit fdce534 — no Codecov upload in Build & Package logs).
  • Adds bundle-stats.yml: runs next build --webpack as a parallel CI job purely so the Codecov plugin can register and upload bundle stats via OIDC. The deploy build in build.yml stays on Turbopack.

Caveat

Reports webpack bundle sizes, not the Turbopack bundles we actually ship. Reasonable proxy for regression detection; not exact for absolute size. Revisit when Codecov ships a Turbopack plugin.

Test plan

  • Workflow runs on this PR and uploads bundle analysis for sleepypod-core to Codecov.
  • Build & Package (Turbopack) remains untouched.

ng added 2 commits May 10, 2026 12:36
Matches the OIDC auth used for coverage/test-results uploads (PR #535)
so the build workflow no longer needs a CODECOV_TOKEN secret. Gate
the plugin on GITHUB_ACTIONS so local builds skip the upload step.
Next.js 16 defaults to Turbopack, which skips next.config.mjs's
webpack() hook — so @codecov/nextjs-webpack-plugin never registers
in the deploy build. Add a parallel job that runs `next build --webpack`
solely so the plugin can upload bundle stats via OIDC. The deploy
build in build.yml stays on Turbopack.
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@ng has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 44 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8447df3a-e538-4adb-8a51-687f89d66338

📥 Commits

Reviewing files that changed from the base of the PR and between cb389c9 and d9fcb9d.

📒 Files selected for processing (3)
  • .github/workflows/build.yml
  • .github/workflows/bundle-stats.yml
  • next.config.mjs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/codecov-bundle-stats

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented May 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

ng added 2 commits May 10, 2026 12:53
@trpc/react-query@11's shared chunk uses ESM named exports that webpack
can't resolve (Turbopack handles them). Gate transpilePackages on
CODECOV_BUNDLE_STATS=1 so prod Turbopack builds are untouched.
@trpc/react-query v11 ships ESM bundled by tsdown with __commonJS/
__toESM interop wrappers. Webpack's strict ESM analysis can't see
named exports through them and fails to compile, though runtime is
fine. Set exportsPresence: 'warn' for the bundle-stats build only.
@ng

ng commented May 10, 2026

Copy link
Copy Markdown
Contributor Author

Closing — next build --webpack as a CI-only side-build for Codecov bundle stats isn't a viable path on Next.js 16.

Why:

  • Turbopack is the default in v16; the webpack flag is a sunset escape hatch, not a maintained build path. Dep authors target Turbopack, so webpack-mode hits bit-rot on every upgrade (we already hit two unrelated ones in one build: @trpc/react-query v11's tsdown ESM interop, and Babel's regen-unicode-properties choking on @messageformat/parser's \p{Pattern_Syntax}).
  • The measured artifact (webpack) isn't what ships (Turbopack) — different tree-shaking/splitting/minification means trend lines diverge from the real bundle. False-positive blocks or missed real regressions.
  • Codecov has no Turbopack plugin today. Until they ship one, there's no clean path.

What stays: the OIDC switch in #538 is harmless — the webpack() hook is dead code under Turbopack but costs nothing and lights up automatically the day Codecov ships Turbopack support.

If we ever want bundle-regression visibility before then: diff .next/ route chunk sizes from the actual Turbopack build and post a PR comment. ~30 lines of CI, no vendor, no second bundler.

@ng ng closed this May 10, 2026
@ng
ng deleted the ci/codecov-bundle-stats branch May 10, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant