anki/ts/bundle_ts.mjs
Damien Elmes 7f5e3c8106 Add env var to enable sourcemaps
They slow down the build, so are not on by default.
2022-12-04 11:37:16 +10:00

21 lines
548 B
JavaScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { build } from "esbuild";
import { argv, env } from "process";
const [_node, _script, entrypoint, bundle_js] = argv;
// support Qt 5.14
const target = ["es6", "chrome77"];
build({
bundle: true,
entryPoints: [entrypoint],
outfile: bundle_js,
minify: env.RELEASE && true,
sourcemap: env.SOURCEMAP ? "inline" : false,
preserveSymlinks: true,
target,
}).catch(() => process.exit(1));