17 lines
394 B
JavaScript
17 lines
394 B
JavaScript
const { build } = require("esbuild"),
|
|
{ copyFile } = require("fs");
|
|
|
|
const production = process.env.NODE_ENV === "production",
|
|
formats = ["cjs", "esm"];
|
|
|
|
(async () => {
|
|
for (const format of formats) {
|
|
await build({
|
|
entryPoints: ["./src/index.ts"],
|
|
watch: !production,
|
|
format,
|
|
outfile: `./dist/index${format === "cjs" ? "" : "." + format}.js`
|
|
});
|
|
}
|
|
})();
|