T
TanStack2mo ago
fascinating-indigo

Export variable is not defined in "ssr.mjs"

Having a lot of trouble getting my docker build to run successfully, using turbo repo. Build works locally, I've got a couple of internal packages I'm importing but they all seem accounted for The error:
web:build: transforming...✓ 560 modules transformed.
15.16 web:build: rendering chunks...
15.24 web:build: ✓ built in 1.55s
15.47 web:build: [nitro] ✔ Generated public .output/public
15.54 web:build: [nitro] ℹ Building Nitro Server (preset: node-server, compatibility date: 2024-11-19)
40.40 web:build:
40.40 web:build: [nitro] ERROR RollupError: Exported variable "b" is not defined in "ssr.mjs".
40.40 web:build:
40.40 web:build:
40.40 web:build: undefined
40.40 web:build:
40.40 web:build: error during build:
40.40 web:build: RollupError: Exported variable "b" is not defined in "ssr.mjs".
web:build: transforming...✓ 560 modules transformed.
15.16 web:build: rendering chunks...
15.24 web:build: ✓ built in 1.55s
15.47 web:build: [nitro] ✔ Generated public .output/public
15.54 web:build: [nitro] ℹ Building Nitro Server (preset: node-server, compatibility date: 2024-11-19)
40.40 web:build:
40.40 web:build: [nitro] ERROR RollupError: Exported variable "b" is not defined in "ssr.mjs".
40.40 web:build:
40.40 web:build:
40.40 web:build: undefined
40.40 web:build:
40.40 web:build: error during build:
40.40 web:build: RollupError: Exported variable "b" is not defined in "ssr.mjs".
2 Replies
fascinating-indigo
fascinating-indigoOP2mo ago
FROM node:22 AS base


FROM base AS deps
WORKDIR /app

COPY ./package.json ./pnpm-lock.yaml* ./
RUN npm install -g pnpm@9.7.0 turbo@2.5.4
COPY . .

RUN turbo prune web --docker

FROM base AS installer
WORKDIR /app

RUN npm install -g pnpm@9.7.0 turbo@2.5.4

COPY --from=deps /app/out/json/ .
RUN pnpm install --frozen-lockfile

COPY --from=deps /app/out/full/ .

RUN pnpm turbo run build --filter=web --env-mode loose

FROM base AS runner
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 tanstack
USER tanstack

COPY --from=installer --chown=tanstack:nodejs /app/apps/web/.output ./.output

EXPOSE 3000


CMD ["node", "./.output/server/index.mjs"]
FROM node:22 AS base


FROM base AS deps
WORKDIR /app

COPY ./package.json ./pnpm-lock.yaml* ./
RUN npm install -g pnpm@9.7.0 turbo@2.5.4
COPY . .

RUN turbo prune web --docker

FROM base AS installer
WORKDIR /app

RUN npm install -g pnpm@9.7.0 turbo@2.5.4

COPY --from=deps /app/out/json/ .
RUN pnpm install --frozen-lockfile

COPY --from=deps /app/out/full/ .

RUN pnpm turbo run build --filter=web --env-mode loose

FROM base AS runner
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 tanstack
USER tanstack

COPY --from=installer --chown=tanstack:nodejs /app/apps/web/.output ./.output

EXPOSE 3000


CMD ["node", "./.output/server/index.mjs"]
The message is quite cryptic and there isn't a ssr file that exists in my repo so I presume it's something internal, can anyone point me in the right direction? Resolved - caused by import aliases, would be good to have a better error if possible
optimistic-gold
optimistic-gold4w ago
@skuse What was wrong with the import aliases? I think I'm having the same issue except I'm trying to add Supabase Auth and it breaks in the similar way

Did you find this page helpful?