iframe and Firefox fixes

This commit is contained in:
Mario Zechner 2025-10-02 02:15:33 +02:00
parent 4b0703cd5b
commit faefc63309
11 changed files with 472 additions and 380 deletions

View file

@ -1,5 +1,5 @@
import { build, context } from "esbuild";
import { copyFileSync, existsSync, mkdirSync, rmSync } from "node:fs";
import { copyFileSync, existsSync, mkdirSync, rmSync, watch } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
@ -51,8 +51,9 @@ const copyStatic = () => {
"icon-16.png",
"icon-48.png",
"icon-128.png",
join("src", "sandbox.html"),
join("src", "sandbox.js"),
join("src", "sidepanel.html"),
join("src", "sandbox.html")
];
for (const relative of filesToCopy) {
@ -82,6 +83,16 @@ const run = async () => {
const ctx = await context(buildOptions);
await ctx.watch();
copyStatic();
for (const file of filesToCopy) {
watch(file, (eventType) => {
if (eventType === 'change') {
console.log(`\n${file} changed, copying static files...`);
copyStatic();
}
});
}
process.stdout.write("Watching for changes...\n");
} else {
await build(buildOptions);