fix treeshaking

fix-15337
7nik 3 months ago
parent 6cc509b4e1
commit 264931f78d

@ -59,12 +59,7 @@ export function head(render_fn) {
try {
block(() => render_fn(anchor), HEAD_EFFECT);
if (hydrating) {
if (hydrate_node === null || /** @type {Comment} */ (hydrate_node).data !== HYDRATION_END) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
}
check_end();
} catch (error) {
// re-mount only this svelte:head
if (was_hydrating && head_anchor && error === HYDRATION_ERROR) {
@ -102,3 +97,11 @@ export function head(render_fn) {
}
}
}
// treeshaking of hydrate node fails when this is directly in the try-catch
function check_end() {
if (hydrating && /** @type {Comment|null} */ (hydrate_node)?.data !== HYDRATION_END) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
}
Loading…
Cancel
Save