From 3f729babf4f79042b06a020849875605dc88c39e Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sat, 15 Jan 2022 21:03:04 -0800 Subject: [PATCH] [fix] ignore hash links during prerendering (again) --- .changeset/grumpy-panthers-mate.md | 5 +++++ packages/kit/src/core/adapt/prerender/prerender.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/grumpy-panthers-mate.md diff --git a/.changeset/grumpy-panthers-mate.md b/.changeset/grumpy-panthers-mate.md new file mode 100644 index 000000000000..1672e153be49 --- /dev/null +++ b/.changeset/grumpy-panthers-mate.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +[fix] ignore hash links during prerendering (again) diff --git a/packages/kit/src/core/adapt/prerender/prerender.js b/packages/kit/src/core/adapt/prerender/prerender.js index 2aa5ef535c71..1fcb5222796a 100644 --- a/packages/kit/src/core/adapt/prerender/prerender.js +++ b/packages/kit/src/core/adapt/prerender/prerender.js @@ -223,7 +223,7 @@ export async function prerender({ cwd, out, log, config, build_data, fallback, a if (is_html && config.kit.prerender.crawl) { for (const href of crawl(/** @type {string} */ (rendered.body))) { - if (href.startsWith('data:')) continue; + if (href.startsWith('data:') || href.startsWith('#')) continue; const resolved = resolve(path, href); if (!is_root_relative(resolved)) continue;