Skip to content

Conversation

@mstange
Copy link
Contributor

@mstange mstange commented Jan 20, 2026

I noticed that webpack was still including the gz worker in the generated symbolicator-cli bundle. And esbuild was even putting it in a separate file. But we don't need the gz worker in the symbolicator-cli bundle; symbolicator-cli targets node so we really just want to run the node version of gz.ts.

This PR makes the "node" version the default behaviour of gz.ts, and then adds a browser override via the package.json "browser" mapping to use the worker version.

In our tests we want to use the worker version though, because we want to test what happens in a browser environment. So we use a custom jest-resolver.js. I tried to use browser-resolve (as suggested in the Jest docs) in it but it ended up resolving some ESM dependencies like valibot to their mjs variant instead of their CJS variant and broke the tests, so I kept a manual implementation instead. I didn't dig very deep.

With this change, the symbolicator-cli bundle no longer contains the gz worker code.

@mstange mstange self-assigned this Jan 20, 2026
@mstange mstange requested a review from canova as a code owner January 20, 2026 01:38
@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 57.57576% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.67%. Comparing base (98b5328) to head (3278553).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/gz.ts 0.00% 12 Missing ⚠️
src/utils/gz.browser.ts 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5764      +/-   ##
==========================================
- Coverage   85.69%   85.67%   -0.02%     
==========================================
  Files         316      317       +1     
  Lines       31141    31145       +4     
  Branches     8582     8584       +2     
==========================================
- Hits        26686    26684       -2     
- Misses       4025     4031       +6     
  Partials      430      430              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mstange mstange force-pushed the gz-node-browser-split branch 2 times, most recently from b1c5b70 to 2754ecf Compare January 20, 2026 16:00
Use the browser variant in Jest tests.
@mstange mstange force-pushed the gz-node-browser-split branch from 2754ecf to 3278553 Compare January 20, 2026 16:23
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