// esbuild.js const { build } = require('esbuild') const fs = require('fs') const define = {} // to ensure that React and Preact doesn't complain. define[`process`] = undefined define[`process.env.NODE_ENV`] = JSON.stringify(process.env.NODE_ENV) build({ entryPoints: ['src/index.ts'], bundle: true, outfile: 'dist/index.js', publicPath: 'dist', define, minify: false, metafile: true, tsconfig: "./tsconfig.json", loader: { '.webp': 'file', }, watch: { onRebuild(error, result) { if (error) console.error('watch build failed:', error) else console.error('watch build succeeded:', result) }, } }).then((result) => { fs.writeFileSync('meta.json', JSON.stringify(result.metafile)) })