From da69164a648264e91c4454c95c921679b6ff6095 Mon Sep 17 00:00:00 2001 From: "Stephane Lacoin (aka nxmatic)" Date: Mon, 18 Mar 2024 21:09:33 +0100 Subject: [PATCH] BDE-226 relocated locally all /index-* includes in popup web pages --- vite.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vite.config.js b/vite.config.js index 8bfb431d..d7d05a91 100644 --- a/vite.config.js +++ b/vite.config.js @@ -49,7 +49,7 @@ export default defineConfig(({ mode }) => { input: `src/${paths[buildEntry].input}`, output: { dir: `dist/${browserVendor}/${buildEntry}`, - format: 'iife', + format: 'es', inlineDynamicImports: false, entryFileNames: '[name]/index.js', chunkFileNames: 'chunks/[name].js', @@ -133,7 +133,7 @@ export default defineConfig(({ mode }) => { // Move index.html to root and update script source const htmlFilePath = path.resolve(__dirname, `dist/${browserVendor}/${buildEntry}/src/${buildEntry}/index.html`); let htmlContent = fs.readFileSync(htmlFilePath, 'utf-8'); - htmlContent = htmlContent.replace('/index.js', './index.js'); + htmlContent = htmlContent.replace(/"\/(index[^"]*)"/g, '"./$1"'); fs.writeFileSync(path.resolve(__dirname, `dist/${browserVendor}/${buildEntry}/index.html`), htmlContent); fs.unlinkSync(htmlFilePath);