diff --git a/lib/index.ts b/lib/index.ts index 788ef799..a0b63b23 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -222,7 +222,7 @@ export default function browserExtension( let webExtRunner: any; let isWatching: boolean; let finalConfig: UserConfig; - let scriptInputs: BuildScriptCache[]; + let scriptInputs: BuildScriptCache[] | undefined; return { name: "vite-plugin-web-extension", @@ -320,7 +320,7 @@ export default function browserExtension( async closeBundle() { log("Content scripts to build in lib mode:", scriptInputs); - for (const input of scriptInputs) { + for (const input of scriptInputs ?? []) { await buildScript({ ...input, vite: finalConfig,