25 lines
588 B
JavaScript
25 lines
588 B
JavaScript
import { build } from 'esbuild';
|
|
import { copyFileSync, mkdirSync } from 'fs';
|
|
import { dirname } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
// Ensure dist directory exists
|
|
mkdirSync('dist', { recursive: true });
|
|
|
|
// Build JavaScript
|
|
await build({
|
|
entryPoints: ['src/game-viewport.js'],
|
|
bundle: true,
|
|
format: 'esm',
|
|
outfile: 'dist/game-viewport.js',
|
|
platform: 'browser',
|
|
});
|
|
|
|
// Copy HTML file
|
|
copyFileSync('src/index.html', 'dist/index.html');
|
|
|
|
console.log('Build complete!');
|
|
|