Skip to content

Commit

Permalink
Build script exports global name, works on older node versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
fdb committed Apr 7, 2023
1 parent 6c1211c commit d51bb04
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import * as esbuild from "esbuild";

await esbuild.build({
entryPoints: ["src/g.js"],
bundle: true,
minify: true,
sourcemap: true,
format: "esm",
outfile: "dist/esm/g.min.js",
});
(async () => {
await esbuild.build({
entryPoints: ["src/g.js"],
bundle: true,
minify: true,
sourcemap: true,
format: "esm",
outfile: "dist/esm/g.min.js",
});

await esbuild.build({
entryPoints: ["src/g.js"],
bundle: true,
minify: true,
sourcemap: true,
format: "iife",
outfile: "dist/iife/g.min.js",
});
await esbuild.build({
entryPoints: ["src/g.js"],
bundle: true,
minify: true,
sourcemap: true,
globalName: "g",
format: "iife",
outfile: "dist/iife/g.min.js",
});
})();

0 comments on commit d51bb04

Please sign in to comment.