// esbuild.js import * as esbuild from 'esbuild' import minimist from 'minimist' const build = async () => { const argv = minimist(process.argv.slice(2)) const shouldWatch = argv.w ? true : false /** * @type {esbuild.BuildOptions} */ const buildOptions = { entryPoints: ['example/index.ts'], bundle: true, outfile: 'example/dist/index.js', publicPath: 'dist', loader: { '.webp': 'file', } } if (shouldWatch) { const context = await esbuild.context(buildOptions) context.watch() } else { await esbuild.build(buildOptions) } } build()