perf: deduplicate identical hoisted templates within a component
Merged
MA
6mo ago+172+172+012345678901234567890123456789-62-62-01234567890123456789
Byte-identical templates hoisted from different fragments, elements, or branches now share a single $.from_html factory instead of each emitting its own module-scope variable - this shrinks generated output and avoids redundant runtime template parsing. Dedup is keyed on (content, flags) and is skipped in dev mode (templates there are wrapped in $.add_locations, which embeds per-call-site info).
Before submitting the PR, please make sure you do the following
- It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- Prefix your PR title with
feat:,fix:,chore:, ordocs:. - This message body should clearly illustrate what problems it solves.
- Ideally, include a test that fails without this PR but passes with it.
- If this PR changes code within
packages/svelte/src, add a changeset (npx changeset).
Tests and linting
- Run the tests with
pnpm testand lint the project withpnpm lint