Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/svelte-kit'
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Bomkamp committed Dec 2, 2024
2 parents d2f8d98 + cfa065a commit 350d24a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/plugins/pluginAddEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ const addEntry = ({
)}></script>`
);
},
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(
/<head>/g,
'<head><script type=\\"module\\" src=\\"' + src + '\\"></script>'
);
}
},
},
{
name: 'add-entry',
Expand Down

0 comments on commit 350d24a

Please sign in to comment.