You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.js 394 B

2 years ago
12345678910111213141516
  1. const { build } = require("esbuild"),
  2. { copyFile } = require("fs");
  3. const production = process.env.NODE_ENV === "production",
  4. formats = ["cjs", "esm"];
  5. (async () => {
  6. for (const format of formats) {
  7. await build({
  8. entryPoints: ["./src/index.ts"],
  9. watch: !production,
  10. format,
  11. outfile: `./dist/index${format === "cjs" ? "" : "." + format}.js`
  12. });
  13. }
  14. })();