From e0bd108990fa568cac506fcbdff9e362b16097d2 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sun, 6 Mar 2022 12:48:34 -0600 Subject: [PATCH] refactor: pass updated fleck to @flecks/core/hmr --- packages/http/src/server/build/runtime.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/http/src/server/build/runtime.js b/packages/http/src/server/build/runtime.js index a78283e..0249c15 100644 --- a/packages/http/src/server/build/runtime.js +++ b/packages/http/src/server/build/runtime.js @@ -43,8 +43,9 @@ module.exports = async (flecks) => { source.push('if (module.hot) {'); paths.forEach(([path]) => { source.push(` module.hot.accept('${path}', async () => {`); - source.push(` window.flecks.refresh('${path}', require('${path}'));`); - source.push(` window.flecks.invoke('@flecks/core/hmr', '${path}');`); + source.push(` const updatedFleck = require('${path}');`); + source.push(` window.flecks.refresh('${path}', updatedFleck);`); + source.push(` window.flecks.invoke('@flecks/core/hmr', '${path}', updatedFleck);`); source.push(' });'); }); source.push('}');