From 7b2cdb8269a10973a425079a26683f6ab3789662 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 23 Apr 2021 18:20:22 +0200 Subject: [PATCH] Clear require cache for watch recompiling --- src/frontend/SvelteViewEngine.ts | 1 + views/home.svelte | 6 +++++- views/layout.svelte | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/frontend/SvelteViewEngine.ts b/src/frontend/SvelteViewEngine.ts index 0ce432f..f8cbf12 100644 --- a/src/frontend/SvelteViewEngine.ts +++ b/src/frontend/SvelteViewEngine.ts @@ -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]; diff --git a/views/home.svelte b/views/home.svelte index f0647e9..90d702e 100644 --- a/views/home.svelte +++ b/views/home.svelte @@ -24,7 +24,11 @@ } - + + +

BONJOUR lol

+
+

Hello {count}!

diff --git a/views/layout.svelte b/views/layout.svelte index c97cf66..873748f 100644 --- a/views/layout.svelte +++ b/views/layout.svelte @@ -4,6 +4,12 @@ export let refresh_after = undefined; + + @@ -21,3 +27,8 @@ {/if} + +
+ hello + +