Skip to content

fix(sveltekit): Stop adapter-node 6 output dir probe from deleting the build - #25193

Merged
chargome merged 1 commit into
developfrom
fix-sentry-js-issue-25186
Oct 9, 2026
Merged

chargome merged 1 commit into
developfrom
fix-sentry-js-issue-25186

Conversation

@chargome

@chargome chargome commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

To find the Node adapter's output directory, we call the adapter's adapt() with a stub builder. adapter-node 6 deletes its output folder with fs.rmSync before it uses the builder, so every Vite config load (vite dev, svelte-kit sync, vite build) wiped the user's build/ folder. We now call adapt() from an empty temp cwd, so the delete hits the temp folder instead.

This also fixes custom out detection with SvelteKit 3. The stub builder only had the SvelteKit 2 config shape, so adapter-node 6 threw early and we always fell back to build.

An absolute out path is still deleted, since the temp cwd only protects relative paths.

Fixes #25186

@chargome chargome self-assigned this Oct 8, 2026
@chargome

chargome commented Oct 8, 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 06b4421. Configure here.

…e build

To learn the Node adapter's output directory we call its adapt() with a stub
builder. adapter-node 6 deletes its output dir with fs.rmSync before it uses
the builder, so loading the Vite config (vite dev, svelte-kit sync, ...)
wiped the user's build/ folder. Run adapt() from an empty temp cwd so the
relative delete hits the temp dir instead.

The stub builder also only had the SvelteKit 2 config shape (config.kit.paths),
so adapter-node 6 threw before reporting a custom out dir and we fell back to
build. Provide the SvelteKit 3 shape (config.paths) as well.

Fixes #25186
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chargome
chargome force-pushed the fix-sentry-js-issue-25186 branch from 06b4421 to 4ed6ff3 Compare October 8, 2026 15:34
@chargome
chargome marked this pull request as ready for review October 9, 2026 09:19
@chargome
chargome requested a review from a team as a code owner October 9, 2026 09:19
@chargome
chargome requested review from Lms24, nicohrubec and s1gr1d and removed request for a team October 9, 2026 09:19
@chargome
chargome merged commit 01935a5 into develop Oct 9, 2026
52 checks passed
@chargome
chargome deleted the fix-sentry-js-issue-25186 branch October 9, 2026 12:15
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.

@sentry/sveltekit: loading the Vite config deletes the adapter-node 6 output directory (build/)

2 participants