Skip to content

feat(codecov): bundle analyzer #7829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed

Conversation

avivkeller
Copy link
Member

@avivkeller avivkeller commented Jun 2, 2025

Adds codecov bundle analysis to our CI

@Copilot Copilot AI review requested due to automatic review settings June 2, 2025 15:48
@avivkeller avivkeller requested review from a team as code owners June 2, 2025 15:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request integrates the Codecov bundle analyzer into our CI pipeline.

  • Added the "@codecov/nextjs-webpack-plugin" dev dependency.
  • Updated the Next.js configuration to enable the Codecov plugin when the ANALYZE environment variable is set.
  • Modified the CI workflow to conditionally set the ANALYZE flag for supported OS and event types.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
apps/site/package.json Added Codecov bundle analyzer plugin as a dev dependency.
apps/site/next.config.mjs Integrated the Codecov plugin into the webpack configuration.
.github/workflows/build.yml Updated the build workflow to set the ANALYZE environment variable.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link

vercel bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jun 2, 2025 4:47pm

Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.44%. Comparing base (c11af00) to head (8d8b4d0).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7829      +/-   ##
==========================================
- Coverage   75.48%   75.44%   -0.04%     
==========================================
  Files         101      101              
  Lines        8309     8309              
  Branches      218      218              
==========================================
- Hits         6272     6269       -3     
- Misses       2035     2038       +3     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MattIPv4
Copy link
Member

MattIPv4 commented Jun 2, 2025

Hm, isn't this going to prevent us migrating to turbopack?

@avivkeller
Copy link
Member Author

Hm, isn't this going to prevent us migrating to turbopack?

How so?

@MattIPv4
Copy link
Member

MattIPv4 commented Jun 2, 2025

How so?

This is going to force Next.js to use Webpack, presumably?

@avivkeller
Copy link
Member Author

This is going to force Next.js to use Webpack, presumably?

It doesn't force Next.js to use Webpack. If it's built with turbo, the webpack key is ignored. See https://nextjs.org/docs/app/api-reference/turbopack#unsupported-and-unplanned-features

@MattIPv4
Copy link
Member

MattIPv4 commented Jun 2, 2025

Ah okay, so we'll just lose bundle reporting if we do migrate, but it doesn't outright block it 👍

@avivkeller avivkeller marked this pull request as draft June 2, 2025 16:06
@avivkeller
Copy link
Member Author

Drafting while I verify this works, and see if there is a way to do bundle analysis through Codecov for both Turbopack and Webpack.

@avivkeller avivkeller marked this pull request as ready for review June 2, 2025 16:17
@avivkeller
Copy link
Member Author

@@ -96,6 +97,23 @@ const nextConfig = {
'shiki',
],
},
webpack: (config, options) => {
Copy link
Member

Choose a reason for hiding this comment

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

Does this work even with TurboPack enabled? We are by default building on CI with TurboPack... So I imagine this wouldn't work?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Welp, apparently you passing the webpack config flag is disabling turbopack :/

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Was removed as part of the Cloudflare adapter PR

Copy link
Member Author

@avivkeller avivkeller Jun 2, 2025

Choose a reason for hiding this comment

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

Maybe that should be re enabled? I'll adjust this PR accordingly if that flag is added back

Copy link
Member

Choose a reason for hiding this comment

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

@avivkeller avivkeller marked this pull request as draft June 2, 2025 18:12
@avivkeller
Copy link
Member Author

Drafting while I adjust for turbo pack, plus this shouldn’t land until the flag is re added.

@avivkeller
Copy link
Member Author

There doesn't appear to be an elegant solution to this. We could write our own reporter, but that's more unrealted code we need to maintain.

I'm closing this to give someone else the opportunity to find a solution. We need a reporter that supports both Turbopack and the App Router.

@avivkeller avivkeller closed this Jun 2, 2025
@avivkeller avivkeller deleted the feat/codecov-bundle-analysis branch June 2, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants