From 0dc5405397f400a35e48d5d63088631995ee1fcc Mon Sep 17 00:00:00 2001 From: IvanRodriCalleja Date: Wed, 18 Jan 2023 13:19:22 +0100 Subject: [PATCH] fix(watch-mode): allow run plugin in watch mode --- src/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/index.ts b/src/index.ts index e0abf3e..e8718f9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,6 +38,7 @@ export const chromeExtension = ( const validate = v(); let manifest: ChromeExtensionManifest | undefined; let viteConfig: ResolvedConfig; + let isBuilded = false; /* ----------------- RETURN PLUGIN ----------------- */ return { @@ -53,6 +54,10 @@ export const chromeExtension = ( manifest = manifestProcessor.load(options); options.input = manifestProcessor.resolveInput(options.input); } + // Rebuild input if the function is executed more than one time (watch mode) + if(manifestProcessor.manifest && isBuilded) { + options.input = manifestProcessor.resolveInput(options.input); + } // resolve scripts and assets in html options.input = htmlProcessor.resolveInput(options.input); logger.logInputFiles(options.input);