fix(gateway): use esbuild to bundle workspace packages in Docker
Replace tsc with esbuild for building @multica/sdk and @multica/store in the Docker builder stage. esbuild resolves extensionless imports that Node.js ESM cannot handle at runtime, producing self-contained bundles for each workspace package. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
01f64ff1ec
commit
5ba8c87744
1 changed files with 5 additions and 2 deletions
|
|
@ -14,10 +14,13 @@ COPY packages/store/package.json ./packages/store/
|
|||
# Install all dependencies (including devDependencies for build)
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Copy workspace packages and build them
|
||||
# Copy workspace packages and bundle them with esbuild (resolves extensionless imports)
|
||||
COPY packages/sdk/ ./packages/sdk/
|
||||
COPY packages/store/ ./packages/store/
|
||||
RUN pnpm --filter @multica/sdk build && cd packages/store && ../../node_modules/.bin/tsc
|
||||
RUN ./node_modules/.bin/esbuild packages/sdk/src/index.ts \
|
||||
--bundle --platform=node --format=esm --outfile=packages/sdk/dist/index.js --packages=external && \
|
||||
./node_modules/.bin/esbuild packages/store/src/index.ts packages/store/src/connection.ts \
|
||||
--bundle --splitting --platform=node --format=esm --outdir=packages/store/dist --packages=external
|
||||
|
||||
# Copy source code
|
||||
COPY tsconfig.json ./
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue