1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 22:08:02 +00:00
_/esbuild/build.mjs

10 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" });