Skip to content

fix: error when an adapter tries to delete the SvelteKit build output - #16595

Open
Nic-Polumeyv wants to merge 3 commits into
sveltejs:version-3from
Nic-Polumeyv:netlify-publish-outdir-guard
Open

fix: error when an adapter tries to delete the SvelteKit build output#16595
Nic-Polumeyv wants to merge 3 commits into
sveltejs:version-3from
Nic-Polumeyv:netlify-publish-outdir-guard

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #16592

Setting publish = ".svelte-kit/output/client" makes adapter-netlify delete the directory it then copies the client assets from, so the build exits 0 and deploys nothing. I originally guarded the publish value inside adapter-netlify, then noticed adapter-node (out), adapter-static (pages/assets) and adapter-cloudflare (wrangler assets.directory/pages_build_output_dir) can be pointed at the same footgun, so the guard now lives on builder.rimraf instead: it refuses to delete anything overlapping ${outDir}/output, the directory adapters copy the build from.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 30, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 265bc04:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/265bc04c579a364bb4894b96ceac25e28d27481c

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16595

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 265bc04

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Nic-Polumeyv
Nic-Polumeyv marked this pull request as draft July 30, 2026 23:28
@Nic-Polumeyv
Nic-Polumeyv force-pushed the netlify-publish-outdir-guard branch from 969815d to a68237b Compare July 30, 2026 23:45
@Nic-Polumeyv Nic-Polumeyv changed the title fix: error when the publish directory overlaps with the SvelteKit output directory fix: error when an adapter tries to delete the SvelteKit build output Jul 30, 2026
@Nic-Polumeyv
Nic-Polumeyv marked this pull request as ready for review July 31, 2026 00:04
@Rich-Harris

Copy link
Copy Markdown
Member

This feels like overkill to me to be honest. Setting publish = ".svelte-kit/output/client" is a very strange thing to do. I don't think it makes sense to make a utility like rimraf opinionated like this (should we prevent rimraf('src/routes') too? and so on), and in fact I suspect we should deprecate them in favour of fs.rmSync(..., { force: true }) (I think these utilities might date from a time when fs wasn't as expansive?)

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.

static assets (_app/immutable/*) return 404 with adapter-netlify, despite preferStatic: true being correctly set

2 participants