Blog

Technology-Agnostic

Architectural Playground

Juun

Playground
  1. Timeline
  2. 3
003Mar 2025
INFRASTRUCTURE

Package Manager Migration

Migrated from Yarn Berry PnP to PNPM due to Next.js standalone and Vercel monorepo incompatibility

PNPMYarn Berrymonorepopackage managerArticle

Situation

Encountered critical issues with Yarn Berry PnP while trying to deploy this project on Vercel. Vercel's deployment environment builds based on traditional node_modules directories. This required additional configurations to properly build with Yarn Berry's Zip File System, forcing the build system to reference the .pnp.cjs file during build. I found additional problems with the Next.js standalone build option, where bundling dependent modules failed with Yarn Berry ZipFS.

Task

  • Migrate package manager from Yarn Berry to PNPM, maintaining monorepo configurations

Action

1. Package Manager Migration

  • Removed Yarn Berry configuration (.yarnrc.yml, .pnp.cjs)
  • Installed PNPM and configured workspace protocol
  • Updated all package.json workspace references

2. Build System Updates

  • Modified Docker image build for PNPM
  • Updated CI/CD pipeline (GitHub Actions)
  • Configured Vercel build settings for PNPM
  • Verified the standalone build option

3. Monorepo Configuration

  • Migrated from Yarn workspaces to PNPM workspaces
  • Updated Turborepo configuration
  • Verified workspace dependency resolution

Result

Lost zero-install advantage, but the project build became compatible with Vercel's deployment environment and the Next.js standalone build option. Additionally, the Docker image size reduced from over 1GB to 346MB.

Created
March 20, 2025