From d71acd9b4a1177e5def38f7932f3aa492adf902b Mon Sep 17 00:00:00 2001 From: webLiang <38065991+webLiang@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:45:55 +0800 Subject: [PATCH] fix(blog): variable conflict (#444) Co-authored-by: mengxianliang --- utils/plugins/inline-vite-preload-script.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 }), }; },