Skip to content

feat(bundlers): Add orchestrion bundler plugins#22124

Open
timfish wants to merge 6 commits into
developfrom
timfish/feat/orchestrion-bundler-plugins
Open

feat(bundlers): Add orchestrion bundler plugins#22124
timfish wants to merge 6 commits into
developfrom
timfish/feat/orchestrion-bundler-plugins

Conversation

@timfish

@timfish timfish commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

There was already a Vite bundler plugin for orchestrion that included our instrumentations but this PR adds the ability to include additional instrumentations and adds plugins for other bundlers.

I left the Bun plugin out of @sentry/server-utils because there is already one in the Bun package and I can't see it being used anywhere else 🤷‍♂️

@timfish timfish marked this pull request as ready for review July 9, 2026 02:36
@timfish timfish requested a review from a team as a code owner July 9, 2026 02:36
@timfish timfish requested review from JPeer264, andreiborza, isaacs and mydea and removed request for a team July 9, 2026 02:36
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts
* ```
*/
export function sentryOrchestrionPlugin(options: PluginOptions = {}): ReturnType<typeof codeTransformer> {
return codeTransformer(orchestrionTransformOptions(options));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Webpack skips externals stripping

Medium Severity

The new webpack orchestrion plugin only forwards to the upstream transformer and never adjusts externals, unlike the Rollup, esbuild, and Vite wrappers. When instrumented packages stay external, webpack resolves them from node_modules at runtime and the transform never runs, so channel injection silently fails.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f9aaa97. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

webpack always bundles so it isn't required...

Comment thread packages/server-utils/src/orchestrion/bundler/esbuild.ts Outdated
Comment thread packages/server-utils/src/orchestrion/bundler/options.ts Outdated
// and never gets the diagnostics_channel calls injected. Mutating
// `initialOptions` inside `setup` is respected by esbuild — the upstream
// plugin sets `initialOptions.metafile` the same way.
build.initialOptions.external = withoutInstrumentedExternals(build.initialOptions.external);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

esbuild string external crashes setup

Medium Severity

The esbuild plugin always passes build.initialOptions.external into withoutInstrumentedExternals, but esbuild allows external to be a single string as well as a string array. A string has no .filter, so plugin setup can throw and abort the build.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4108067. Configure here.

Comment thread packages/server-utils/src/orchestrion/bundler/rollup.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 5 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b15cb00. Configure here.

Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts
Comment thread packages/server-utils/src/orchestrion/bundler/vite.ts
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