diff --git a/build/html.ts b/build/html.ts index 4310e75..6194399 100644 --- a/build/html.ts +++ b/build/html.ts @@ -35,7 +35,7 @@ export async function buildHTML(game: string, production = false, portable = fal console.log(bundle.outputs); return; } - const iconFile = Bun.file(path.resolve(import.meta.dir, '..', 'games', game, 'assets', 'favicon.ico')); + const iconFile = Bun.file(path.resolve(import.meta.dir, '..', 'src', 'games', game, 'assets', 'favicon.ico')); let icon = ''; if (await iconFile.exists()) { icon = ``; @@ -52,6 +52,7 @@ export async function buildHTML(game: string, production = false, portable = fal } script = script.replaceAll('await Promise.resolve().then(() =>', '('); + let scriptPrefix = ''; if (production) { const minifyResult = UglifyJS.minify(script, { module: true, @@ -61,10 +62,13 @@ export async function buildHTML(game: string, production = false, portable = fal } else { script = minifyResult.code; } + } else { + const eruda = await Bun.file(path.resolve(import.meta.dir, '..', 'node_modules', 'eruda', 'eruda.js')).text(); + scriptPrefix = ``; } const resultHTML = html - .replace('$SCRIPT$', ``) + .replace('$SCRIPT$', () => `${scriptPrefix}`) .replace('$TITLE$', game[0].toUpperCase() + game.slice(1).toLowerCase()) .replace('$ICON$', icon); diff --git a/bun.lockb b/bun.lockb index 1b68a43..45cc0df 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 4843cd9..8d567e5 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@types/inquirer": "9.0.7", "assemblyscript": "0.27.29", "bun-lightningcss": "0.2.0", + "eruda": "3.2.3", "html-minifier": "4.0.0", "typescript": "5.5.2", "uglify-js": "3"