mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
More work on fixing Docker build
This commit is contained in:
parent
015177e3a2
commit
ea1d7b1510
9 changed files with 163 additions and 145 deletions
8
build.ts
8
build.ts
|
|
@ -1,4 +1,5 @@
|
|||
// Delete dist directory
|
||||
import { $ } from "bun";
|
||||
import { cp, exists, mkdir, rm } from "node:fs/promises";
|
||||
import { rawRoutes } from "~routes";
|
||||
|
||||
|
|
@ -13,7 +14,6 @@ await rm("./dist", { recursive: true });
|
|||
|
||||
await mkdir(`${process.cwd()}/dist`);
|
||||
|
||||
//bun build --entrypoints ./index.ts ./prisma.ts ./cli.ts --outdir dist --target bun --splitting --minify --external bullmq,@prisma/client
|
||||
await Bun.build({
|
||||
entrypoints: [
|
||||
`${process.cwd()}/index.ts`,
|
||||
|
|
@ -25,7 +25,7 @@ await Bun.build({
|
|||
outdir: `${process.cwd()}/dist`,
|
||||
target: "bun",
|
||||
splitting: true,
|
||||
minify: true,
|
||||
minify: false,
|
||||
external: ["bullmq"],
|
||||
}).then((output) => {
|
||||
if (!output.success) {
|
||||
|
|
@ -33,6 +33,10 @@ await Bun.build({
|
|||
}
|
||||
});
|
||||
|
||||
// Fix for wrong Bun file resolution, replaces node_modules with ./node_modules inside all dynamic imports
|
||||
// I apologize for this
|
||||
await $`sed -i 's|import("node_modules/|import("./node_modules/|g' dist/*.js`;
|
||||
|
||||
// Create pages directory
|
||||
// mkdir ./dist/pages
|
||||
await mkdir(`${process.cwd()}/dist/pages`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue