tfrere HF Staff commited on
Commit
1f03cd7
·
1 Parent(s): 32a4aca

fix(docker): symlink frontend node_modules into /app/backend so shared imports resolve

Browse files

The frontend build aliases `#shared` to `/app/backend/src/shared/`. Files there import
npm packages (e.g. shiki) that are declared in frontend/package.json. Rollup walks up
from the shared file looking for node_modules and never reaches /app/frontend/ in the
Docker layout, which breaks the build with:

Rollup failed to resolve import "shiki" from /app/backend/src/shared/shiki-config.ts

Local dev avoids this because both workspaces install node_modules side by side. The
symlink reproduces that layout inside the frontend-build stage without pulling any of
the backend runtime deps into the frontend bundle.

Made-with: Cursor

Files changed (1) hide show
  1. Dockerfile +6 -0
Dockerfile CHANGED
@@ -6,6 +6,12 @@ COPY frontend/package.json frontend/package-lock.json* frontend/.npmrc* ./
6
  RUN npm install
7
  COPY frontend/ ./
8
  COPY backend/src/shared/ ../backend/src/shared/
 
 
 
 
 
 
9
  RUN npm run build
10
 
11
  # --- Stage 2: Build backend ---
 
6
  RUN npm install
7
  COPY frontend/ ./
8
  COPY backend/src/shared/ ../backend/src/shared/
9
+ # The shared files import npm packages (e.g. `shiki`) that are declared in the
10
+ # frontend package.json. When rollup resolves those imports from /app/backend/
11
+ # it walks up the tree looking for node_modules; without this symlink it never
12
+ # reaches /app/frontend/node_modules and the build fails with
13
+ # "Rollup failed to resolve import 'shiki'".
14
+ RUN ln -s /app/frontend/node_modules /app/backend/node_modules
15
  RUN npm run build
16
 
17
  # --- Stage 2: Build backend ---