Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nxPublic

esbuild ⁠prune-lockfile executor does not include peer dependencies in generated package.json, unlike webpack ⁠generatePackageJson #33375

Open
Labels
@nicolas-marien

Description

@nicolas-marien

Current Behavior

When building with ⁠esbuild and using the ⁠prune-lockfile executor, peer dependencies of direct dependencies are not included in the generated ⁠package.json. This differs from the behavior when using ⁠webpack with the ⁠generatePackageJson option, which correctly includes all required dependencies including peer dependencies.

Specific example:

  • App depends on a non-buildable library

  • Library depends on ⁠nestjs-pino

  • nestjs-pino declares ⁠pino-http as a peerDependency

  • Result: ⁠pino-http is missing from the generated ⁠package.json

Expected Behavior

The ⁠package.json generation should be idempotent regardless of the bundler used. When using ⁠webpack with ⁠generatePackageJson, all required dependencies including peer dependencies are correctly included. The ⁠esbuild + ⁠prune-lockfile combination should produce the same result. (pino-http should be present)

GitHub Repo

https://github.com/nicolas-marien/nx-peer-dep-package-json-issue

Steps to Reproduce

  1. nx esbuild-build backend (the build fails, but not related to the issue, proceed to step 2)
  2. nx prune-lockfile backend
  3. Inspectapps/backend/package.json

Nx Report

Node: 24.11.0OS: darwin-arm64Native Target: aarch64-macosyarn: 4.10.3nx: 22.0.2@nx/js: 22.0.2@nx/jest: 22.0.2@nx/eslint: 22.0.2@nx/workspace: 22.0.2@nx/devkit: 22.0.2@nx/esbuild: 22.0.2@nx/eslint-plugin: 22.0.2@nx/nest: 22.0.2@nx/node: 22.0.2@nx/web: 22.0.2@nx/webpack: 22.0.2@nx/docker: 22.0.2typescript: 5.9.3---------------------------------------Registered Plugins:@nx/js/typescript@nx/webpack/plugin@nx/eslint/plugin@nx/js/typescript---------------------------------------Cache Usage: 0.00 B / 46.04 GB

Package Manager Version

yarn 4.10.3

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Setup

- TypeScript project references
- All dependencies declared in root ⁠package.json
- Using ⁠prune-lockfile and ⁠copy-workspaces-modules executors
- @nx/dependency-checks ESLint rule enabled
- Dependency structure: App → Non-buildable library → ⁠nestjs-pino → ⁠pino-http (peerDependency)

ESLint behavior:

  • When the library is non-buildable: No violations reported (expected, since the rule doesn't check non-buildable libraries)

  • When the library is buildable: Reports violation for ⁠nestjs-pino but not for ⁠pino-http (the peer dependency)

Workaround:
Manually adding the peer dependencies to the library's ⁠package.json resolves the issue, but this shouldn't be necessary given that webpack handles this automatically.

ImageImageImageImageImage

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp