Skip to content

fix(rolldown): Fix Non-deterministic / changing debug IDs with Rolldown/Vite 8 - #23665

Open
chen-anders wants to merge 3 commits into
getsentry:developfrom
wistia:fix/rolldown-debug-id-determinism
Open

fix(rolldown): Fix Non-deterministic / changing debug IDs with Rolldown/Vite 8#23665
chen-anders wants to merge 3 commits into
getsentry:developfrom
wistia:fix/rolldown-debug-id-determinism

Conversation

@chen-anders

@chen-anders chen-anders commented Aug 26, 2026

Copy link
Copy Markdown
  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

Closes #23448

Summary

This change fixes nondeterministic Sentry debug-ID injection when using Rolldown.

Rolldown computes output filenames and content hashes before all generated chunk content has stabilized. Sentry’s debug-ID injection was being incorporated into that process with a value derived from transient Rolldown output, causing unchanged assets to receive different content hashes across otherwise identical builds.

The fix:

  • Injects a fixed-width placeholder for Rolldown debug IDs before filename hashing.
  • Replaces the placeholder during generateBundle, after Rolldown has resolved output filenames and hashes.
  • Derives the final debug ID from stable chunk content and the final filename, which also disambiguates identical chunks.
  • Keeps the existing content-based behavior for standard Rollup builds.
  • Consolidates the debug-ID, Rollup-version, and Vite annotation handling into clearer modules.

Motivation

Our Vite production builds can be run with cache-busting enabled, but unchanged static assets should still produce identical content hashes.

AI Usage Disclaimer: Written with GPT 5.6 Sol ; tested on our own internal codebase and verified that the output JS assets are deterministic

Testing

  • Added focused tests for debug-ID placeholder injection and finalization.
  • Added Rolldown determinism coverage for:
    • Rolldown 1.1.2
    • Rolldown 1.2.5
  • Passed the bundler-plugin package lint, type checks, tests, and builds.
  • Verified two clean-cache Wistia Vite production builds produced identical output:
    • 2,527 emitted files matched exactly.
    • The internally maintained webComponents asset was byte-identical between builds.

Method used for testing on our internal codebase:

  • Yarn compile our codebase, record list of compiled static assets + SHA256SUM of all files
  • Clear Yarn/Vite caches
  • Run yarn compile again, record list of compiled static assets + SHA256SUM of all files

With this fix, the file names and SHA256 values were identical.

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.

Non-deterministic / changing debug IDs

1 participant