Clear require cache for watch recompiling

This commit is contained in:
Alice Gaudon 2021-04-23 18:20:22 +02:00
parent a97e68289e
commit 7b2cdb8269
3 changed files with 17 additions and 1 deletions

View File

@ -317,6 +317,7 @@ export default class SvelteViewEngine extends ViewEngine {
});
const locals = this.getGlobals();
delete require.cache[path.resolve(file)];
return requireFromString(svelteSsr.js.code, file).default.render({
swaf: (key: string, args?: unknown[]) => {
if (!args) return locals[key];

View File

@ -24,7 +24,11 @@
}
</style>
<Layout title="Home"/>
<Layout title="Home">
<svelte:fragment slot="body">
<h1>BONJOUR lol</h1>
</svelte:fragment>
</Layout>
<h1>Hello {count}!</h1>

View File

@ -4,6 +4,12 @@
export let refresh_after = undefined;
</script>
<style>
.body {
border: 1px solid blue;
}
</style>
<svelte:head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
@ -21,3 +27,8 @@
<meta http-equiv="refresh" content={refresh_after}>
{/if}
</svelte:head>
<div class="body">
hello
<slot name="body"/>
</div>