use esbuild for watch
This commit is contained in:
parent
dcd22a9d8c
commit
069400233a
5 changed files with 27 additions and 343 deletions
12
build.mjs
12
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
|
||||
|
@ -29,3 +30,12 @@ await build({
|
|||
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