/** * 打包支付中心概览用的 ECharts 子集。 * * cd assets/admin && npm run build:pay-charts * * echarts 是 assets/admin 的 devDependency;产物入库,部署时无需安装 node 依赖。 */ import { createRequire } from 'node:module'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const adminDir = path.join(repoRoot, 'assets/admin'); const require = createRequire(path.join(adminDir, 'package.json')); const { build } = require('esbuild'); const outfile = path.join(repoRoot, 'assets/js/runtime/libs/echarts-pay.min.js'); await build({ entryPoints: [path.join(repoRoot, 'tools/echarts-pay-overview.entry.mjs')], outfile, bundle: true, format: 'iife', minify: true, target: ['es2018'], legalComments: 'inline', nodePaths: [path.join(adminDir, 'node_modules')], logLevel: 'info', });