sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
77.35k stars 4.03k forks source link

Svelte 5.0.0-next.142 regression #11972

Open Serator opened 2 weeks ago

Serator commented 2 weeks ago

Describe the bug

Hey Svelte team. 👋

Unfortunately, I don't have an example to reproduce yet, but hopefully the following description will help to clarify the details.

I get the following runtime error when running an app on SvelteKit in npm run preview:

image image

The bug is not reproduced in dev mode.

My investigation revealed that the regression occurred in Svelte 5.0.0-next.142 (in the current version 5.0.0-next.152, the bug is still reproduced).

In Svelte 5.0.0-next.141 everything worked fine.

I'm guessing it has something to do with this Pr: https://github.com/sveltejs/svelte/pull/11758

System Info

* "@sveltejs/kit": "2.5.10",
* "svelte": "5.0.0-next.152",

Severity

blocking an upgrade

Serator commented 2 weeks ago

The problem is due to aggressive whitespace removal during html output optimization.

I use htmlnano for this in hooks.server.ts with the collapseWhitespace: "aggressive" option - description.

Reproduction link.

Note that if you replace <svelte:component this={Picture} /> with <Picture /> in the demo at the link above, the problem goes away despite aggressively removing spaces.