fix(api): bundle with tsup to resolve ESM shared module execution

This commit is contained in:
AyrisAI
2026-08-20 02:16:07 +03:00
parent bace019314
commit e56f92bf56
4 changed files with 744 additions and 9 deletions
+4 -7
View File
@@ -8,14 +8,11 @@ RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml tsconfig.base.json ./ COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml tsconfig.base.json ./
COPY packages/shared/package.json ./packages/shared/
COPY apps/api/package.json ./apps/api/
RUN pnpm install --frozen-lockfile --filter @menulio/api...
COPY packages/shared ./packages/shared COPY packages/shared ./packages/shared
COPY apps/api ./apps/api COPY apps/api ./apps/api
RUN pnpm install --frozen-lockfile --filter @menulio/api...
RUN pnpm --filter @menulio/api build RUN pnpm --filter @menulio/api build
FROM node:22-alpine AS runner FROM node:22-alpine AS runner
@@ -29,9 +26,9 @@ RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 fastify RUN adduser --system --uid 1001 fastify
COPY --from=builder /app/package.json /app/pnpm-lock.yaml* /app/pnpm-workspace.yaml ./ COPY --from=builder /app/package.json /app/pnpm-lock.yaml* /app/pnpm-workspace.yaml ./
COPY --from=builder /app/packages/shared ./packages/shared COPY --from=builder /app/apps/api/dist ./apps/api/dist
COPY --from=builder /app/apps/api ./apps/api
COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/apps/api/node_modules ./apps/api/node_modules
USER fastify USER fastify
+3 -2
View File
@@ -5,8 +5,8 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "tsx watch --env-file=.env src/index.ts", "dev": "tsx watch --env-file=.env src/index.ts",
"build": "tsc -p tsconfig.json", "build": "tsup",
"start": "node --env-file=.env dist/index.js", "start": "node dist/index.js",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"lint": "eslint src" "lint": "eslint src"
}, },
@@ -22,6 +22,7 @@
"devDependencies": { "devDependencies": {
"@types/node": "^22.9.0", "@types/node": "^22.9.0",
"@types/qrcode": "^1.5.5", "@types/qrcode": "^1.5.5",
"tsup": "^8.5.1",
"tsx": "^4.19.2", "tsx": "^4.19.2",
"typescript": "^5.6.3" "typescript": "^5.6.3"
} }
+10
View File
@@ -0,0 +1,10 @@
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
format: ["esm"],
clean: true,
noExternal: ["@menulio/shared"],
target: "node20",
sourcemap: false,
});
+727
View File
File diff suppressed because it is too large Load Diff