Skip to content

fix(server-utils): Bundle the CommonJS dependencies of instrumented packages on Vite 8 - #25523

Draft
s1gr1d wants to merge 1 commit into
developfrom
sigridhuemer/js-3951-sveltekit-3-sentry-118-build-time-instrumentation-breaks
Draft

s1gr1d wants to merge 1 commit into
developfrom
sigridhuemer/js-3951-sveltekit-3-sentry-118-build-time-instrumentation-breaks

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Oct 19, 2026

Copy link
Copy Markdown
Member

On Vite 8, Rolldown emits a require() of an external package in bundled CommonJS as __require(). Adapters that bundle the server output again (Nitro, the Azure SWA adapter) can't follow it, so pg-types and similar packages go missing at runtime. Vite 7 emitted static imports instead.

On Rolldown only, the plugin now also bundles the dependencies that instrumented CommonJS requires. Optional and peer dependencies stay external. We didn't use esmExternalRequirePlugin, because it turns function-exported CommonJS into objects on Node < 23. The bug needs a flat node_modules, hence the new hoisted E2E variant.

Stacked on #25359.

Fixes #25470

@linear-code

linear-code Bot commented Oct 19, 2026

Copy link
Copy Markdown

JS-3951

@s1gr1d
s1gr1d added this pull request to stack #25525 October 19, 2026 13:34
Base automatically changed from jp/react-router-orchestrion-core-default-import to develop October 19, 2026 16:07
…ackages on Vite 8

Rolldown emits a require() of an external package in bundled CommonJS as
__require(), which a bundler that runs over the server output cannot follow.
On Rolldown, the orchestrion Vite plugin now also force-bundles the
dependencies that the CommonJS code of instrumented packages requires.

Fixes #25470
@JPeer264
JPeer264 force-pushed the sigridhuemer/js-3951-sveltekit-3-sentry-118-build-time-instrumentation-breaks branch from 2286e1b to bfe4ef2 Compare October 19, 2026 16:07

This branch has not been deployed

No deployments
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