modsecurity-integration/esbuild.config.js
Dorian Niemiec 67c0c8b97f
Some checks failed
Repo sync GitHub -> SVR.JS Git server / svrjsgit (push) Has been cancelled
chore: init
2025-01-12 18:33:26 +01:00

40 lines
872 B
JavaScript

const esbuild = require("esbuild");
const isDev = process.env.NODE_ENV == "development";
if (!isDev) {
esbuild
.build({
entryPoints: ["src/index.js"],
bundle: true,
outfile: "dist/mod.js", // Mod output file
platform: "node",
target: "es2017",
external: ["modsecurity"]
})
.catch((err) => {
throw err;
});
} else {
esbuild
.context({
entryPoints: ["src/index.js"],
bundle: true,
outfile: "svrjs/mods/mod.js", // Mod output file
platform: "node",
target: "es2017",
external: ["modsecurity"]
})
.then((ctx) => {
ctx
.watch()
.then(() => {
console.log("Watching for changes in SVR.JS mod source code...");
})
.catch((err) => {
throw err;
});
})
.catch((err) => {
throw err;
});
}