-
Notifications
You must be signed in to change notification settings - Fork 51
fix(vite): Skip HTML injection for MPA but keep it for SPA #843
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛Plugin Manager
Other
Documentation 📚
Build / dependencies / internal 🔧
🤖 This preview updates automatically when you update the PR. |
logaretm
approved these changes
Jan 16, 2026
Collaborator
logaretm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this, good one!
Lms24
approved these changes
Jan 16, 2026
2 tasks
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Jan 20, 2026
| datasource | package | from | to | | ---------- | ------------------- | ----- | ----- | | npm | @sentry/vite-plugin | 4.6.1 | 4.7.0 | ## [v4.7.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#470) - docs: Add RELEASE.md to document release process ([#834](getsentry/sentry-javascript-bundler-plugins#834)) - feat: Combine injection plugins ([#844](getsentry/sentry-javascript-bundler-plugins#844)) - fix(plugin-manager): Enable "rejectOnError" in debug ([#837](getsentry/sentry-javascript-bundler-plugins#837)) - fix(plugin-manager): Respect `sourcemap.ignore` values for injecting debugIDs ([#836](getsentry/sentry-javascript-bundler-plugins#836)) - fix(vite): Skip HTML injection for MPA but keep it for SPA ([#843](getsentry/sentry-javascript-bundler-plugins#843)) <details> <summary> <strong>Internal Changes</strong> </summary> - chore: Use pull\_request\_target for changelog preview ([#842](getsentry/sentry-javascript-bundler-plugins#842)) - ci(release): Switch from action-prepare-release to Craft ([#831](getsentry/sentry-javascript-bundler-plugins#831)) - test: Ensure Debug IDs match ([#840](getsentry/sentry-javascript-bundler-plugins#840)) </details> ## [v4.6.2](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#462) - fix(vite): Ensure sentryVitePlugin always returns an array of plugins ([#832](getsentry/sentry-javascript-bundler-plugins#832)) - fix(vite): Skip code injection for HTML facade chunks ([#830](getsentry/sentry-javascript-bundler-plugins#830)) - fix(rollup): Prevent double-injection of debug ID ([#827](getsentry/sentry-javascript-bundler-plugins#827)) - fix(esbuild): fix debug ID injection when moduleMetadata or applicationKey is set ([#828](getsentry/sentry-javascript-bundler-plugins#828))
renovate bot
added a commit
to andrei-picus-tink/auto-renovate
that referenced
this pull request
Jan 20, 2026
| datasource | package | from | to | | ---------- | ------------------- | ----- | ----- | | npm | @sentry/vite-plugin | 4.6.1 | 4.7.0 | ## [v4.7.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#470) - docs: Add RELEASE.md to document release process ([#834](getsentry/sentry-javascript-bundler-plugins#834)) - feat: Combine injection plugins ([#844](getsentry/sentry-javascript-bundler-plugins#844)) - fix(plugin-manager): Enable "rejectOnError" in debug ([#837](getsentry/sentry-javascript-bundler-plugins#837)) - fix(plugin-manager): Respect `sourcemap.ignore` values for injecting debugIDs ([#836](getsentry/sentry-javascript-bundler-plugins#836)) - fix(vite): Skip HTML injection for MPA but keep it for SPA ([#843](getsentry/sentry-javascript-bundler-plugins#843)) <details> <summary> <strong>Internal Changes</strong> </summary> - chore: Use pull\_request\_target for changelog preview ([#842](getsentry/sentry-javascript-bundler-plugins#842)) - ci(release): Switch from action-prepare-release to Craft ([#831](getsentry/sentry-javascript-bundler-plugins#831)) - test: Ensure Debug IDs match ([#840](getsentry/sentry-javascript-bundler-plugins#840)) </details> ## [v4.6.2](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#462) - fix(vite): Ensure sentryVitePlugin always returns an array of plugins ([#832](getsentry/sentry-javascript-bundler-plugins#832)) - fix(vite): Skip code injection for HTML facade chunks ([#830](getsentry/sentry-javascript-bundler-plugins#830)) - fix(rollup): Prevent double-injection of debug ID ([#827](getsentry/sentry-javascript-bundler-plugins#827)) - fix(esbuild): fix debug ID injection when moduleMetadata or applicationKey is set ([#828](getsentry/sentry-javascript-bundler-plugins#828))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes a regression introduced by PR #830 where debug IDs were not being injected into SPA main bundles. The original fix for issue #829 skipped all chunks with HTML facades to prevent creating unnecessary modules in Vite MPA builds. However, in SPAs, the main entry bundle also has an HTML facade but contains actual application code that needs debug ID injection.
This change adds a
containsOnlyImportshelper that checks whether a chunk's code is purely import/export statements. Now, HTML facade chunks are only skipped if they contain just imports (true MPA facades), while chunks with substantial code (SPA main bundles) get debug IDs injected as expected.While the previous fix for #829 already added test cases, I also tested this locally with the reproduction example shared in the issue description. It still works as expected.
Closes #839