Skip to content

feat: use modulerunner for ssr#3645

Open
lishaduck wants to merge 4 commits intodenoland:mainfrom
lishaduck:envapi2
Open

feat: use modulerunner for ssr#3645
lishaduck wants to merge 4 commits intodenoland:mainfrom
lishaduck:envapi2

Conversation

@lishaduck
Copy link
Copy Markdown
Contributor

Extracted from/stacked upon #3634.

bartlomieju and others added 3 commits March 25, 2026 19:13
The switch from ssrLoadModule to ModuleRunner removed stack trace
source mapping. Re-add setErrorInterceptor call so errors in route
handlers get source-mapped before the error overlay renders them,
and ssrFixStacktrace in the outer catch for module loading errors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
) as FetchHandler;
mod.setErrorInterceptor?.((err: unknown) => {
if (err instanceof Error) {
server.ssrFixStacktrace(err);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If this works to fix it, then that's great, but in theory it shouldn't be needed 🤔

server.ssrFixStacktrace and server.ssrRewriteStacktrace do not have to be called when using the Module Runner APIs. The stack traces will be updated unless sourcemapInterceptor is set to false. — SSR Using ModuleRunner API

I assumed it was because sourcemapInterceptor was indeed false because Deno had nooped process.setSourceMapsEnabled, but fixing that didn't seem to fix it.

Relevant Vite code: https://github.com/vitejs/vite/blob/99897d27b44dd73307fa03e2f11f0baa1a1dc939/packages/vite/src/node/ssr/runtime/serverModuleRunner.ts#L58-L72

@lishaduck lishaduck changed the title Use ModuleRunner for SSR feat: use modulerunner for ssr Mar 29, 2026
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.

2 participants