nx
nx copied to clipboard
ESBuild cannot generate package.json with the new TypeScript setup
Current Behavior
In Nx 19, @nx/esbuild was capable of generating a package.json and package-lock.json with the generatePackageJson option.
In Nx 20, @nx/esbuild returns this error when trying to generate a package.json and package-lock.json with the generatePackageJson option.
NX Setting 'generatePackageJson: true' is not supported with the new (default) TypeScript setup. Update the 'package.json' file at the project root as needed and unset the 'generatePackageJson' option.
This feature is a major requirement for building Docker containers, since it allows to only install the NPM packages used by the project and not the NPM packages of the whole workspace.
Am I missing something here?
Expected Behavior
The generatePackageJson options works in @nx/esbuild with the new (default) TypeScript setup (or an alternative option is provided).
GitHub Repo
No response
Steps to Reproduce
For Nx 19
npx create-nx-workspace@19 ws19 --workspaceType=integrated
cd ws19
nx add @nx/node
nx generate @nx/node:application --projectNameAndRootFormat=as-provided --directory=packages/node-esbuild --bundler=esbuild --e2eTestRunner=none --framework=express --unitTestRunner=none
nx build node-esbuild
For Nx 20
npx create-nx-workspace@20 ws20 --ci=skip --formatter=none
cd ws20
nx add @nx/node
nx generate @nx/node:application --directory=packages/node-esbuild --bundler=esbuild --e2eTestRunner=none --framework=express --linter=none --unitTestRunner=none
nx build node-esbuild
Nx Report
Node : 20.15.1
OS : win32-x64
Native Target : x86_64-windows
npm : 10.8.2
nx : 19.8.14
@nx/js : 19.8.14
@nx/jest : 19.8.14
@nx/linter : 19.8.14
@nx/eslint : 19.8.14
@nx/workspace : 19.8.14
@nx/devkit : 19.8.14
@nx/esbuild : 19.8.14
@nx/eslint-plugin : 19.8.14
@nx/node : 19.8.14
@nrwl/tao : 19.8.14
typescript : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
Failure Logs
Package Manager Version
No response
Operating System
- [ ] macOS
- [x] Linux
- [x] Windows
- [ ] Other (Please specify)
Additional Information
No response