diff --git a/.changeset/hot-news-bake.md b/.changeset/hot-news-bake.md new file mode 100644 index 000000000000..ab6178a23a68 --- /dev/null +++ b/.changeset/hot-news-bake.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +reload dev page on change of app.html diff --git a/packages/kit/src/exports/vite/dev/index.js b/packages/kit/src/exports/vite/dev/index.js index 778b369de67a..02056f176d0c 100644 --- a/packages/kit/src/exports/vite/dev/index.js +++ b/packages/kit/src/exports/vite/dev/index.js @@ -235,6 +235,18 @@ export async function dev(vite, vite_config, svelte_config) { sync.update(svelte_config, manifest_data, file); }); + const { appTemplate } = svelte_config.kit.files; + // vite client only executes a full reload if the triggering html file path is index.html + // kit defaults to src/app.html, so unless user changed that to index.html + // send the vite client a full-reload event without path being set + if (appTemplate !== 'index.html') { + vite.watcher.on('change', (file) => { + if (file === appTemplate) { + vite.ws.send({ type: 'full-reload' }); + } + }); + } + const assets = svelte_config.kit.paths.assets ? SVELTE_KIT_ASSETS : svelte_config.kit.paths.base; const asset_server = sirv(svelte_config.kit.files.assets, { dev: true,