diff --git a/utils/plugins/inline-vite-preload-script.ts b/utils/plugins/inline-vite-preload-script.ts index 18c0a8dd1..2b9d9b703 100644 --- a/utils/plugins/inline-vite-preload-script.ts +++ b/utils/plugins/inline-vite-preload-script.ts @@ -23,7 +23,7 @@ export default function inlineVitePreloadScript(): PluginOption { } } return { - code: __vitePreload + code.split(`\n`).slice(1).join(`\n`), + code: `(function () {${__vitePreload + code.split(`\n`).slice(1).join(`\n`)}})()`, map: new MagicString(code).generateMap({ hires: true }), }; },