fix(api): bundle with tsup to resolve ESM shared module execution
This commit is contained in:
+4
-7
@@ -8,14 +8,11 @@ RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
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 apps/api ./apps/api
|
||||
|
||||
RUN pnpm install --frozen-lockfile --filter @menulio/api...
|
||||
|
||||
RUN pnpm --filter @menulio/api build
|
||||
|
||||
FROM node:22-alpine AS runner
|
||||
@@ -29,9 +26,9 @@ RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 fastify
|
||||
|
||||
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 ./apps/api
|
||||
COPY --from=builder /app/apps/api/dist ./apps/api/dist
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/apps/api/node_modules ./apps/api/node_modules
|
||||
|
||||
USER fastify
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "tsx watch --env-file=.env src/index.ts",
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"start": "node --env-file=.env dist/index.js",
|
||||
"build": "tsup",
|
||||
"start": "node dist/index.js",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "eslint src"
|
||||
},
|
||||
@@ -22,6 +22,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.9.0",
|
||||
"@types/qrcode": "^1.5.5",
|
||||
"tsup": "^8.5.1",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "^5.6.3"
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
Generated
+727
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user