Repository navigation
fix(esbuild): avoid warnings for entries without a default export - #26123
adityareddy-dev wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5e08cb3. Configure here.
| 'esbuild-plugin', | ||
| path.basename(resolvedPath), | ||
| ), | ||
| namespace: 'sentry-debug-id-proxy', |
There was a problem hiding this comment.
Proxy namespace missing onLoad handler
High Severity
The debug ID wrapper is now resolved into the sentry-debug-id-proxy namespace, but the loader that emits that wrapper still listens on the default file namespace. esbuild will not load the proxy, so debug ID injection fails and the build errors when sourcemaps are enabled.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 5e08cb3. Configure here.
There was a problem hiding this comment.
onLoad({ filter: /.*/ }) has no namespace filter, so it handles sentry-debug-id-proxy too. esbuild only restricts the callback when a namespace is provided (docs).
|
Thanks for looking into this! Unfortunately moving the proxy into its own namespace with a fake We went with a narrower fix in #26132 that sets |
… default export (#26132) **Why:** The debug ID proxy statically re-exports the entry's default export so downstream bundlers can tree-shake, which makes esbuild warn with `import-is-undefined` whenever an entry has no default export. esbuild can't suppress a diagnostic per file, so the plugin sets `logOverride['import-is-undefined'] = 'silent'` in `initialOptions`, same as it already forces `metafile`. The proxy's path, suffix and namespace stay as they are, so other plugins, source maps and the metafile are unaffected. Tradeoff: this silences the warning for the whole build. A user-provided `logOverride` for that id wins, so it can be turned back on. Supersedes #26123, which relied on an undocumented esbuild heuristic and changed the proxy's namespace and path in ways other plugins observe. **How to review:** Four lines in `packages/bundler-plugins/src/esbuild/index.ts`, plus `test/esbuild/entry-without-default-export.test.ts`. Closes #25885 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… default export (getsentry#26132) **Why:** The debug ID proxy statically re-exports the entry's default export so downstream bundlers can tree-shake, which makes esbuild warn with `import-is-undefined` whenever an entry has no default export. esbuild can't suppress a diagnostic per file, so the plugin sets `logOverride['import-is-undefined'] = 'silent'` in `initialOptions`, same as it already forces `metafile`. The proxy's path, suffix and namespace stay as they are, so other plugins, source maps and the metafile are unaffected. Tradeoff: this silences the warning for the whole build. A user-provided `logOverride` for that id wins, so it can be turned back on. Supersedes getsentry#26123, which relied on an undocumented esbuild heuristic and changed the proxy's namespace and path in ways other plugins observe. **How to review:** Four lines in `packages/bundler-plugins/src/esbuild/index.ts`, plus `test/esbuild/entry-without-default-export.test.ts`. Closes getsentry#25885 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>


Why: The debug ID wrapper warns when an entry has no default export. I gave the wrapper a virtual dependency path so esbuild lowers that warning, while keeping static default access so downstream builds can remove unused exports. Maintainer go-ahead.
How to review: Start with the wrapper path in
src/esbuild/index.ts, thentest/esbuild/entry-exports.test.ts, both underpackages/bundler-plugins.Unsure about: This relies on esbuild's handling of dependency diagnostics. The wrapper's identity also changes in source maps and metadata, though the real entry keeps its path.
Closes #25885