// 把 xacro-parser 打成一个浏览器可直接 import 的文件:vendor/xacro/xacro-parser.js // 只在升级依赖时运行:node scripts/xacro-bundle.mjs import { build } from 'esbuild'; import { writeFileSync, rmSync } from 'node:fs'; const entry = new URL('./.xacro-entry.mjs', import.meta.url).pathname; writeFileSync(entry, "export { XacroParser } from 'xacro-parser/src/XacroParser.js';\n"); await build({ entryPoints: [entry], bundle: true, format: 'esm', minify: true, platform: 'browser', outfile: new URL('../vendor/xacro/xacro-parser.js', import.meta.url).pathname }); rmSync(entry); console.log('ok');