chore(popperjs): use Rslib to build (#13252)

This commit is contained in:
neverland
2024-12-08 16:44:55 +08:00
committed by GitHub
parent e825175615
commit 8018fc19e6
7 changed files with 23 additions and 63 deletions

View File

@@ -1,40 +0,0 @@
const { build, context } = require('esbuild');
async function bundle(format) {
const ext = format === 'esm' ? '.mjs' : '.js';
const outfile = `dist/index.${format}${ext}`;
const finish = () => console.log('Build finished:', outfile);
const options = {
format,
bundle: true,
target: ['chrome53'],
outfile,
// preserve Chinese character
charset: 'utf8',
external: ['vue', 'vant'],
entryPoints: ['./src/index.ts'],
};
if (process.argv.includes('-w')) {
const loggerPlugin = {
name: 'loggerPlugin',
setup(build) {
build.onEnd(finish);
},
};
const ctx = await context({
...options,
plugins: [loggerPlugin],
});
await ctx.watch();
} else {
await build(options);
finish();
}
}
bundle('esm');
bundle('cjs');

View File

@@ -37,7 +37,6 @@
"license": "MIT",
"devDependencies": {
"@rslib/core": "^0.1.3",
"esbuild": "^0.24.0",
"typescript": "^5.7.2",
"vue": "^3.5.13"
},