From cfa065a49c827433757a1ca88051faf961079335 Mon Sep 17 00:00:00 2001 From: Robin Bomkamp Date: Fri, 29 Nov 2024 10:04:55 +0100 Subject: [PATCH] fix: Dev mode is not working in SvelteKit --- src/plugins/pluginAddEntry.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/pluginAddEntry.ts b/src/plugins/pluginAddEntry.ts index e257cfd..83eee64 100644 --- a/src/plugins/pluginAddEntry.ts +++ b/src/plugins/pluginAddEntry.ts @@ -75,6 +75,19 @@ const addEntry = ({ )}>` ); }, + transform(code, id) { + if (id.includes('node_modules') || inject !== 'html' || htmlFilePath) { + return; + } + + if (id.includes('.svelte-kit') && id.includes('internal.js')) { + const src = devEntryPath.replace(/.+?\:([/\\])[/\\]?/, '$1').replace(/\\\\?/g, '/'); + return code.replace( + //g, + '' + ); + } + }, }, { name: 'add-entry',