diff --git a/Dockerfile b/Dockerfile index b0509815..1130e2fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,4 +70,4 @@ COPY --chown=bun:bun --from=builder /app/prisma.config.ts.prod ./prisma.config.t EXPOSE 3000 # Default command: run migrations and start API server -CMD ["sh", "-c", "bun prisma migrate deploy && bun apps/web/src/index.js"] +CMD ["sh", "-c", "bun prisma migrate deploy && bun index.js"] diff --git a/apps/web/src/index.ts b/apps/web/src/index.ts index 8db017c9..744f967e 100644 --- a/apps/web/src/index.ts +++ b/apps/web/src/index.ts @@ -59,15 +59,29 @@ const server = Bun.serve( const filepath = join(import.meta.dir, url.pathname) const file = Bun.file(filepath) if (await file.exists()) { - return new Response(file) + try { + const stat = await file.stat() + if (stat.isFile()) { + return new Response(file) + } + } catch { + // ignore stat errors + } } - const htmlFile = Bun.file(join(import.meta.dir, 'shumai-app.html')) + const htmlFile = Bun.file(join(import.meta.dir, 'index.html')) if (await htmlFile.exists()) { return new Response(htmlFile, { headers: { 'Content-Type': 'text/html' }, }) } + + const htmlFileNpm = Bun.file(join(import.meta.dir, 'shumai-app.html')) + if (await htmlFileNpm.exists()) { + return new Response(htmlFileNpm, { + headers: { 'Content-Type': 'text/html' }, + }) + } } return app.fetch(req) diff --git a/build.ts b/build.ts index 25ce4446..f5aac79b 100644 --- a/build.ts +++ b/build.ts @@ -20,6 +20,7 @@ await Bun.build({ target: 'bun', outdir: outdir, minify: false, + naming: '[name].[ext]', plugins: [ temporalWorkflow({ bundleOptions: {},