mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: initial commit
This commit is contained in:
42
esbuild.config.ts
Normal file
42
esbuild.config.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import esbuild from "esbuild";
|
||||
|
||||
import dotenv, { type DotenvParseOutput } from "dotenv";
|
||||
|
||||
const result = dotenv.config({ path: ".env.production" });
|
||||
|
||||
function prepareDefine(config: DotenvParseOutput | undefined) {
|
||||
const define = {};
|
||||
// @ts-ignore
|
||||
for (const [key, value] of Object.entries(config)) {
|
||||
// @ts-ignore
|
||||
define[`process.env.${key}`] = JSON.stringify(value);
|
||||
}
|
||||
return define;
|
||||
}
|
||||
|
||||
const define = prepareDefine(result.parsed);
|
||||
try {
|
||||
esbuild
|
||||
.build({
|
||||
entryPoints: {
|
||||
server: "server/server.ts",
|
||||
"reset-password": "reset-password.ts",
|
||||
},
|
||||
bundle: true,
|
||||
platform: "node",
|
||||
format: "esm",
|
||||
target: "node18",
|
||||
outExtension: { ".js": ".mjs" },
|
||||
minify: true,
|
||||
sourcemap: true,
|
||||
outdir: "dist",
|
||||
tsconfig: "tsconfig.server.json",
|
||||
define,
|
||||
packages: "external",
|
||||
})
|
||||
.catch(() => {
|
||||
return process.exit(1);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
Reference in New Issue
Block a user