mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 06:18:07 +00:00
11 lines
417 B
JavaScript
11 lines
417 B
JavaScript
|
import { readFile } from "fs/promises";
|
||
|
import esbuild from "esbuild";
|
||
|
const { build } = esbuild;
|
||
|
const entryPoint = "src/index.ts";
|
||
|
const { main: cjs, module: esm } = JSON.parse(
|
||
|
await readFile(new URL("./package.json", import.meta.url))
|
||
|
);
|
||
|
const base = { entryPoints: [entryPoint], sourcemap: true, bundle: true };
|
||
|
build({ ...base, outfile: esm, format: "esm" });
|
||
|
build({ ...base, outfile: cjs, format: "cjs" });
|