Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@nx/esbuild v19 does not support pnpm v9 properly #22954

Closed
4 tasks
DibyodyutiMondal opened this issue Apr 23, 2024 · 2 comments
Closed
4 tasks

@nx/esbuild v19 does not support pnpm v9 properly #22954

DibyodyutiMondal opened this issue Apr 23, 2024 · 2 comments

Comments

@DibyodyutiMondal
Copy link

DibyodyutiMondal commented Apr 23, 2024

Current Behavior

Following is a part of the configuration for a node.js api project

      options": {
        "platform": "node",
        "outputPath": "dist/apps/api",
        "format": ["esm"],
        "bundle": true,
        "main": "apps/api/src/index.ts",
        "tsConfig": "apps/api/tsconfig.app.json",
        "assets": ["apps/api/src/assets"],
        "generatePackageJson": true,
        "esbuildOptions": {
          "sourcemap": true,
          "outExtension": {
            ".js": ".js"
          }
        }
      },

When I run nx build api the output bundles all of the npm packages into the output. It does generate a package.json in the output, but it does not populate the dependencies field.

Expected Behavior

The build output should not contain npm packages. It should only bundle my code, and it should populate the dependencies field.

GitHub Repo

No response

Steps to Reproduce

  1. Use @nx/js to generate an app
  2. Use any external npm module (example: use firebase-admin and simply call initializeApp() in index.js
  3. build the app (using @nx/esbuild) and check the output

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.11.1
OS     : linux-x64
pnpm   : 8.15.7

nx (global)        : 19.0.0-beta.2
nx                 : 19.0.0-beta.2
@nx/js             : 19.0.0-beta.2
@nx/jest           : 19.0.0-beta.2
@nx/eslint         : 19.0.0-beta.2
@nx/angular        : 19.0.0-beta.2
@nx/devkit         : 19.0.0-beta.2
@nx/esbuild        : 19.0.0-beta.2
@nx/eslint-plugin  : 19.0.0-beta.2
@nx/node           : 19.0.0-beta.2
@nx/playwright     : 19.0.0-beta.2
@nrwl/tao          : 19.0.0-beta.2
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@fortawesome/angular-fontawesome : 0.14.1
@ngrx/effects                    : 17.2.0
@ngrx/store                      : 17.2.0
@ngrx/store-devtools             : 17.2.0

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

Please note that while nx report mentions that the pnpm version 8.15.7, this report was generated after I reverted to pnpm v8. The problem actually occured on pnpm v9.

I placed a breakpoint inside of @nx/esbuild, inside a function called getExtraDependencies. When using pnpm@9, the externalDependencies array was empty. When using pnpm@8, it was populated with the proper dependencies.

The value of this externalDependencies array was affecting the output generated by esbuild.

I think nx is not yet compatible with pnpm@9. The actual issue probably resolves around the pnpm-lock.yaml. pnpm@8 uses lockfile version 6 and pnpm@9 uses lockfile version 9.

@DibyodyutiMondal
Copy link
Author

DibyodyutiMondal commented Apr 23, 2024

Closing, as this is most likely a dupe of #22929

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant