45 lines
1.0 KiB
JavaScript
Executable File
45 lines
1.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
// @ts-check
|
|
const { build } = require("esbuild")
|
|
const sassPlugin = require("esbuild-plugin-sass")
|
|
const { nodeBuiltIns } = require("esbuild-node-builtins")
|
|
|
|
const args = process.argv.slice(2)
|
|
|
|
build({
|
|
bundle: true,
|
|
define: {
|
|
"process.browser": "true",
|
|
"process.env.BLUEPRINT_NAMESPACE": '"bp4"',
|
|
global: "globalThis",
|
|
},
|
|
entryPoints: ["electron/app/index.tsx"],
|
|
inject: ["./scripts/react-shim.js"],
|
|
outdir: "electron/bundled",
|
|
external: ["path", "glob", "fs", "util"],
|
|
jsxFactory: "esbuildCreateElement",
|
|
jsxFragment: "esbuildFragment",
|
|
plugins: [
|
|
sassPlugin(),
|
|
nodeBuiltIns({
|
|
include: ["path", "fs"],
|
|
}),
|
|
],
|
|
target: ["chrome90"],
|
|
tsconfig: "./tsconfig.json",
|
|
sourcemap: "inline",
|
|
minify: process.env.NODE_ENV === "production",
|
|
banner: {
|
|
js: "/* eslint-disable */",
|
|
},
|
|
loader: {
|
|
".png": "file",
|
|
".eot": "file",
|
|
".svg": "file",
|
|
".woff": "file",
|
|
".woff2": "file",
|
|
".ttf": "file",
|
|
},
|
|
watch: args.includes("-w") || args.includes("--watch"),
|
|
})
|