41 lines
872 B
JavaScript
41 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;
|
||
|
});
|
||
|
}
|