From 1f564a423648a3885b2283de90af3f1c5d84b52c Mon Sep 17 00:00:00 2001 From: Aaron Klinker Date: Mon, 8 Nov 2021 16:20:07 -0600 Subject: [PATCH] fix: don't crash when there are no scripts --- lib/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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,