1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 06:18:07 +00:00
_/esbuild/build.mjs

11 lines
417 B
JavaScript
Raw Permalink Normal View History

2020-12-18 12:40:53 +09:00
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" });