Vite build silently failed on CircleCI (exit code 1) — fixed by more memory, but can it run on smaller machines?

Hi all,

I recently ran into a strange issue when building my Vite project on CircleCI.

Build command:

NODE_OPTIONS="--max-old-space-size=3000" pnpm exec -- cross-env WEB_BUILD=1 vite build --configLoader runner

Log output:

vite v7.1.7 building for production...
[sentry-vite-plugin] Info: Sending telemetry data...
transforming...

✓ 4725 modules transformed.
rendering chunks...

Exited with code exit status 1

There was no error message or stack trace — just exit status 1.
It worked perfectly on my local machine, even 1GB memory in docker.

After some testing, I found that:

  • Increasing memory to --max-old-space-size=6000

  • And switching CircleCI’s resource_class to large

…made the build succeed.

So this looks like an out-of-memory issue, but without any “Killed” message or exit code 137/143 in the logs.


Question

Is there any way to:

  1. Run Vite successfully on smaller resource classes (e.g., medium) without hitting OOM?

  2. Get better diagnostics in CircleCI when Node is killed due to memory (since no message was shown)?


Configuration

version: 2.1

jobs:
  build-web:
    docker:
      - image: cimg/node:25.1.0
    parameters:
      stage:
        type: string
      build_command:
        type: string
        default: NODE_OPTIONS="--max-old-space-size=6000" pnpm exec -- cross-env WEB_BUILD=1 vite build --configLoader runner
    resource_class: large # TODO: try medium after optimizing memory usage
    steps:
      - checkout

      - run:
          name: Configure pnpm
          command: |
            pnpm config set store-dir ~/.pnpm-store

      - restore_cache:
          key: pnpm-store-v1-cache-{{ checksum "pnpm-lock.yaml" }}

      - run:
          name: Install workspace dependencies
          command: pnpm install --frozen-lockfile

      - save_cache:
          key: pnpm-store-v1-{{ checksum "pnpm-lock.yaml" }}
          paths:
            - ~/.pnpm-store
    
      - run:
          name: Build web assets
          command: << parameters.build_command >>
          working_directory: apps/desktop

      - persist_to_workspace:
          root: .
          paths:
            - apps/desktop/out/web

Thanks in advance for any insight — especially tips for memory tuning or surfacing OOM errors on CircleCI.