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:esbuild with thirdParty: false using pnpm 8.6.0 bundles all dependencies #17410

Closed
1 of 4 tasks
atsjo opened this issue Jun 4, 2023 · 3 comments
Closed
1 of 4 tasks

Comments

@atsjo
Copy link

atsjo commented Jun 4, 2023

Current Behavior

@nx/esbuild:esbuild with thirdParty: false using pnpm bundles all dependencies. With yarn it works as expected, bundling only local projects, and adding external dependencies to package.json.

Expected Behavior

@nx/esbuild:esbuild with thirdParty: false bundles only local repo projects with pnpm, the same way it works with yarn.

GitHub Repo

No response

Steps to Reproduce

  1. create js project with esbuild bundling
  2. add thirdParty: false to @nx/esbuild:esbuild options
  3. add some external dependencies to project and bundle

I suspect this is because of the different layout of node_modules when using pnpm. I also use generatePackageJson: true to generate package.json, and with pnpm my package.json looks like this:
{
"name": "@teve/task4s-firebase",
"engines": {
"node": "18"
},
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"dependencies": {
"tslib": "^2.5.3"
},
"private": true
}
and the bundle is 664550 lines long

and with yarn my package.json looks like this:
{
"name": "@teve/task4s-firebase",
"engines": {
"node": "18"
},
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"dependencies": {
"@azure/msal-common": "13.0.0",
"@azure/msal-node": "1.17.2",
"@microsoft/microsoft-graph-client": "3.0.5",
"date-fns": "2.30.0",
"firebase-admin": "11.8.0",
"firebase-functions": "4.4.0",
"gaxios": "5.1.0",
"google-auth-library": "8.8.0",
"googleapis": "118.0.0",
"lru-cache": "9.1.1",
"tslib": "^2.5.2"
},
"private": true
}
and the bundle is 1184 lines long

Nx Report

Node   : 18.16.0
   OS     : win32 x64
   pnpm   : 8.6.0
   Hasher : Native

   nx                 : 16.3.2
   @nx/js             : 16.3.2
   @nx/jest           : 16.3.2
   @nx/linter         : 16.3.2
   @nx/workspace      : 16.3.2
   @nx/angular        : 16.3.2
   @nx/cypress        : 16.3.2
   @nx/devkit         : 16.3.2
   @nx/esbuild        : 16.3.2
   @nx/eslint-plugin  : 16.3.2
   @nrwl/tao          : 16.3.2
   @nx/webpack        : 16.3.2
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   angular-calendar : 0.31.0
   ---------------------------------------
   Local workspace plugins:
         @teve/integration
         @teve/firebase
         @teve/angular
         @teve/common
         @teve/task4s-all
         @teve/task4s-web

Failure Logs

No response

Operating System

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

Additional Information

No response

@atsjo atsjo added the type: bug label Jun 4, 2023
@atsjo atsjo changed the title @nx/esbuild:esbuild with thirdParty: false using pnpm bundles all dependencies @nx/esbuild:esbuild with thirdParty: false using pnpm 8.6.0 bundles all dependencies Jun 5, 2023
@atsjo
Copy link
Author

atsjo commented Jun 5, 2023

It also works with pnpm 8.5.1, so this is because of the changed lockfile format (v6 -> v6.1), where there currently is a PR: #17407

@atsjo
Copy link
Author

atsjo commented Jun 13, 2023

pnpm v8.6.2 reverts lockfile version number back to 6.0, to fix compatibility issues with older versions of pnpm... That also fixes this issue, as the version matching code in nx now works again:-)

@atsjo atsjo closed this as completed Jun 13, 2023
@github-actions
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 Jul 14, 2023
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

2 participants