Skip to content

feat(remix): Run the orchestrion transform on Remix 3 browser modules - #24894

Merged
chargome merged 1 commit into
developfrom
charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules
Oct 2, 2026
Merged

chargome merged 1 commit into
developfrom
charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules

Conversation

@chargome

Copy link
Copy Markdown
Member

Remix 3 has no bundler, so the build time plugin the other SDKs use has nothing to attach to. The asset server compiles each module on request through a loader chain, and that is the only compile time hook the browser has. This adds a loader there that applies orchestrion's transform, and patches run in @remix-run/ui so component render errors are captured with no application code.

@sentry/server-utils gains a load-hook entry for callers with a file path and its source and no bundler in between. It is bundled like the webpack loader, so @sentry/remix does not need the transformer as a dependency.

The transform imports the browser diagnostics_channel shim by public URL, encoded the way the asset server encodes imports and listed in scripts.external. A mismatched URL would load two shims and no instrumentation. The shim is now an explicit rollup entry, because nothing in the module graph uses its default export and rollup dropped it.

Fixes #24677

@chargome chargome self-assigned this Sep 30, 2026
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@linear-code

linear-code Bot commented Sep 30, 2026

Copy link
Copy Markdown

JS-3772

@chargome
chargome added this pull request to stack #24884 September 30, 2026 12:52

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/remix/src/v3/orchestrionLoader.ts
Comment thread packages/server-utils/src/orchestrion/bundler/load-hook.ts
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.51 kB - -
@sentry/browser - with treeshaking flags 27.68 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.58 kB - -
@sentry/browser (incl. Tracing) 51.46 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.47 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.47 kB - -
@sentry/browser (incl. Tracing, Replay) 91.05 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.03 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.73 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.72 kB - -
@sentry/browser (incl. Feedback) 47.04 kB - -
@sentry/browser (incl. sendFeedback) 34.57 kB - -
@sentry/browser (incl. FeedbackAsync) 39.69 kB - -
@sentry/browser (incl. Metrics) 30.53 kB - -
@sentry/browser (incl. Logs) 30.82 kB - -
@sentry/browser (incl. Metrics & Logs) 31.48 kB - -
@sentry/react 31.36 kB - -
@sentry/react (incl. Tracing) 53.82 kB - -
@sentry/vue 37.51 kB - -
@sentry/vue (incl. Tracing) 54.36 kB - -
@sentry/svelte 29.54 kB - -
@sentry/remix (Remix 3 client bundle) 55.77 kB +0.56% +310 B 🔺
CDN Bundle 31.22 kB - -
CDN Bundle (incl. Tracing) 51.99 kB - -
CDN Bundle (incl. Logs, Metrics) 33.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.94 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.2 kB - -
CDN Bundle (incl. Tracing, Replay) 89.56 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.54 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.73 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.73 kB - -
CDN Bundle - uncompressed 92.14 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.53 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.71 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.48 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.28 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.26 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.89 kB - -
@sentry/nextjs (client) 56.33 kB - -
@sentry/sveltekit (client) 51.88 kB - -
@sentry/core/server 39.99 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 144.51 kB +0.08% +115 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.1 kB +0.11% +90 B 🔺
@sentry/node - without tracing 93.06 kB +0.12% +105 B 🔺
@sentry/node - without channel injection 122.76 kB +0.01% +11 B 🔺
@sentry/aws-serverless 101.36 kB +0.11% +109 B 🔺
@sentry/cloudflare (withSentry) - minified 207.1 kB - -
@sentry/cloudflare (withSentry) 515.31 kB - -

View base workflow run

@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from 6639e08 to e9f6e49 Compare September 30, 2026 13:08

@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.

Stale Bugbot comment from a previous run.

@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from e9f6e49 to 29218a8 Compare September 30, 2026 13:41
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch 3 times, most recently from c7e625f to b48cc8b Compare September 30, 2026 14:43
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from b48cc8b to 39eb61f Compare September 30, 2026 15:01
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/remix/src/v3/assetServer.ts
Comment thread packages/remix/src/v3/client/diagnosticsChannelShim.ts Outdated
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from 39eb61f to 7130dc2 Compare September 30, 2026 15:16
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/remix/src/v3/orchestrionLoader.ts
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from 7130dc2 to 975f10a Compare October 1, 2026 08:02
@chargome

chargome commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@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.

Stale Bugbot comment from a previous run.

@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from 975f10a to be24564 Compare October 1, 2026 08:12
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from be24564 to dc72542 Compare October 1, 2026 08:21
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch 2 times, most recently from af75881 to c1d1c18 Compare October 1, 2026 08:46
@chargome

chargome commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/remix/src/v3/orchestrionLoader.ts
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from c1d1c18 to b88a5b5 Compare October 1, 2026 08:57
@chargome

chargome commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b88a5b5. Configure here.

@chargome
chargome marked this pull request as ready for review October 1, 2026 09:13
@chargome
chargome requested review from a team as code owners October 1, 2026 09:13
@chargome
chargome requested review from JPeer264, isaacs, nicohrubec and s1gr1d and removed request for a team October 1, 2026 09:13
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch 2 times, most recently from ee24cbc to 818658f Compare October 1, 2026 14:08
Base automatically changed from charlygomez/js-3767-complete-remix-3-server-error-handling to develop October 1, 2026 15:09
Remix 3 has no bundler, so the build time plugin the other SDKs use has
nothing to attach to. The asset server compiles each module on request
through a loader chain with Node's `load` hook shape, and that is the only
compile time hook the browser pipeline has. This adds a loader there that
applies orchestrion's transform, and patches `run` in `@remix-run/ui` so
component render errors are captured with no application code.

`@sentry/server-utils` gains a `load-hook` entry for callers with a file
path and its source and no bundler in between. It is compiled into that
package's build like the webpack loader, because the `@apm-js-collab`
packages are bundled devDependencies and not resolvable on user installs.
This keeps `@sentry/remix` free of the transformer as a dependency.

The transform imports the browser `diagnostics_channel` shim by public
URL, percent encoded per segment the way the asset server encodes rewritten
imports, and the URL is listed in `scripts.external`. Two spellings of that
URL are two modules to a browser, so a mismatch would load two shims with
two subscriber registries and no instrumentation. The shim is now an
explicit rollup entry: nothing in the module graph uses its default export,
so a non entry module would have it tree shaken away, which the injected
import needs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome
chargome force-pushed the charlygomez/js-3772-run-the-orchestrion-transform-on-browser-modules branch from 818658f to 0a8d1a7 Compare October 1, 2026 15:09
declare global {
// `var`, because only a `var` here becomes a property of `globalThis`.
// oxlint-disable-next-line no-var
var __SENTRY_REMIX_DC_REGISTRY__: Map<string, BrowserTracingChannel> | undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

q/l: You think it would make sense to add this to our GLOBAL_OBJ instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not really as this only affects remix 🤔

@chargome
chargome merged commit 7932813 into develop Oct 2, 2026
267 of 268 checks passed
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.

Run the orchestrion transform on browser modules

2 participants