What problem does it solve?
Migrating an Nx monorepo package from building to a workspace-root dist/packages/<name> directory to building locally into packages/<name>/dist/ involves dozens of coordinated changes across tsconfig, package.json, project.json, eslint, release scripts, and consumer imports. Missing any step causes publish failures, sandbox violations, or runtime module-resolution crashes.
Core Features & Use Cases
- Build layout migration: Rewrites
tsconfig.lib.json to nodenext module resolution with local dist output, and updates package.json with an exports map using the @nx/nx-source condition plus typesVersions fallbacks.
- Release and publish alignment: Configures
project.json release settings (preserveLocalDependencyProtocols, manifestRootsToUpdate), files fields, and scripts/nx-release.ts so versioning and publishing work from the source package root.
- Consumer import codemods: Updates
@nx/<name>/src/* imports across the workspace, optionally locking down the ./src/* wildcard behind a curated ./internal entry point with a shipped migration.
- Use Case: You maintain the Nx repo and need to migrate the
@nx/js package to the local-dist build pattern already used by nx and devkit, including fixing require('../../package.json') fragility and ensurePackage + dynamic import() breakage under nodenext.
Quick Start
Migrate the @nx/js package to the local dist build pattern and update all dependent configuration and imports.