/** * {build} * @author yutent * @date 2021/08/09 11:59:41 */ import Es from 'esbuild' import fs from 'iofs' let args = process.argv.slice(2) let entryPoints = fs.ls('./src', true).filter(it => fs.isfile(it)) if (args.includes('--watch')) { let res = await Es.context({ entryPoints, outdir: 'dist', target: 'es2022', format: 'cjs', // external: ['vscode', 'util'], platform: 'node' // bundle: true }) console.log('监听文件变化中...\n') await res.watch() } else { Es.build({ entryPoints, outdir: 'dist', target: 'es2022', format: 'cjs', minify: true, // external: ['vscode', 'util'], platform: 'node' // bundle: true }) }