From 5a4889d652f699019cf0ffe29352f914e08eed62 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Wed, 26 Mar 2025 15:43:22 +0800 Subject: [PATCH] fix: set inpage ouptut to iife resolve #103 there's a `var _=...` in the `inpage.js` output and it conflicts with google map this PR wraps the output in a self exec function to avoid that for unknown reason update `rollupOptions.output.format` to `iife` does not work --- vite.config.inpage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.inpage.ts b/vite.config.inpage.ts index e47c603..b1a87ce 100644 --- a/vite.config.inpage.ts +++ b/vite.config.inpage.ts @@ -22,7 +22,7 @@ export default defineConfig({ name: 'try-catch', generateBundle(_, context) { Object.values(context).forEach((bundle: any) => { - bundle.code = `try{${bundle.code}}catch{}` + bundle.code = `(function(){try{${bundle.code}}catch{}}())` }) }, },