Skip to content

Commit

Permalink
BDE-226 relocated locally all /index-* includes in popup web pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nxmatic committed Mar 18, 2024
1 parent a55757e commit da69164
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit da69164

Please sign in to comment.