use esbuild for watch
This commit is contained in:
parent
dcd22a9d8c
commit
fbd561b8e7
5 changed files with 24 additions and 376 deletions
14
build.mjs
14
build.mjs
|
@ -1,4 +1,5 @@
|
|||
import { build } from "esbuild";
|
||||
import { spawn } from "child_process";
|
||||
|
||||
/**
|
||||
* @type {esbuild.Plugin}
|
||||
|
@ -6,7 +7,7 @@ import { build } from "esbuild";
|
|||
const makeAllPackagesExternalPlugin = {
|
||||
name: "make-all-packages-external",
|
||||
setup(build) {
|
||||
const filter = /^[^./|~]|^\.[^./]|^\.\.[^/]/; // Must not start with "/" or "./" or "../"
|
||||
const filter = /(oceanic\.js|sqlite3)/; // Whitelist of dumb packages
|
||||
build.onResolve({ filter }, (args) => ({
|
||||
path: args.path,
|
||||
external: true
|
||||
|
@ -22,10 +23,19 @@ await build({
|
|||
target: "esnext",
|
||||
logLevel: "info",
|
||||
outfile: "dist/index.js",
|
||||
minify: true,
|
||||
minify: false,
|
||||
treeShaking: true, // shake it off shake it offff
|
||||
jsx: "transform",
|
||||
inject: ["components-jsx/runtime.ts"],
|
||||
jsxFactory: "createElement",
|
||||
jsxFragment: "Fragment"
|
||||
});
|
||||
|
||||
setInterval(() => {}, 100);
|
||||
|
||||
if (process.argv.includes("start")) {
|
||||
const proc = spawn("node", ["--env-file=.env", "dist/index.js"], {
|
||||
stdio: "inherit"
|
||||
});
|
||||
proc.on("close", (code) => process.exit(code));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue