Repository navigation
Conversation
2286e1b to
bfe4ef2
Compare
48c2e2a to
ae4166d
Compare
|
bugbot run |
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.
Reviewed by Cursor Bugbot for commit ae4166d. Configure here.
| if (source !== SNIPPET_IMPORT_SPECIFIER) { | ||
| return resolveExternalRequire.call(this, source, importer, resolveOptions); | ||
| } | ||
| if (!resolveOptions?.ssr) { |
There was a problem hiding this comment.
Resolver cannot override Vite externalization
High Severity
The new resolveId handler is a default-order function, so Vite's core resolver can mark CommonJS sub-dependencies external before this plugin runs. After a successful resolution, later resolveId hooks are skipped, so those require() calls still become __require() and the deployed server fails with Cannot find module. The force-bundle path also bails when this.resolve returns null, so it cannot recover if the core resolver does not treat the specifier as external.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit ae4166d. Configure here.
There was a problem hiding this comment.
The plugin runs with enforce: 'pre', so it's a false positive
…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
…nJS on Rolldown Resolve each require() call from a package that orchestrion bundled instead of walking package.json files. Only calls that Vite would make external are bundled, and the user's ssr.external entries and optional dependencies stay external.
ae4166d to
5fbc75c
Compare


We put pg into ssr.noExternal and that bundles
pgand changes its CJS imports. In the second bundling step, Rolldown in Vite 8 emits__require("pg-types")for the dependency imports of pg (see their migration guide mentioningesmExternalRequirePlugin- also check the linked rolldown docs). As__requirecomes frommodule.createRequire, the bundlers think it's a normal function variable, and not an import. Therefore, a sub-dependency likepg-typescannot get into the final bundle.The plugin now bundles exactly these
require()calls. The user'sssr.externalentries and optional dependencies stay external. We didn't useesmExternalRequirePlugin, because it breaks function-exported CommonJS on Node < 23.Stacked on #25359.
Fixes #25470
Same problem:
__require()of an external package stays in bundled CommonJSWorkarounds and fixes in other tools
external, so bundled CJS require("<node builtin>") is left as a throwing __require stub vitejs/vite#22618ssr.target=webworkervitejs/vite#23759Existing Sentry issues
@sentry/nuxt11: CommonJS packages inlined for build-time instrumentation break in the Nitro bundle #24775@sentry/react-router11: build-time instrumentation inlines CommonJS that default-imports@sentry/core; server crashes at startup #25339