nx
nx copied to clipboard
fix(core): remove devDependencies in production build
Moved from https://github.com/nrwl/nx/pull/17744
All credits to @robdonn.
Current Behavior
When a local package.json is loaded with a devDependencies property, that property's contents end up in the final outputted package.json, even when isProduction is set to true.
Expected Behavior
When isProduction is true then devDependencies should be removed.
Related Issue(s)
Fixes #
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated (UTC) |
|---|---|---|---|
| nx-dev | ✅ Ready (Inspect) | Visit Preview | Jun 11, 2024 8:36am |
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 3e016191db81be3d547f6d4cea624ad79d3efc77. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 6 targets
nx affected --targets=e2e,e2e-ci --base=16008751ec1bec0066a3266be80d4bf6594ce548 --head=3e016191db81be3d547f6d4cea624ad79d3efc77 --parallel=1nx affected --targets=lint,test,build --base=16008751ec1bec0066a3266be80d4bf6594ce548 --head=3e016191db81be3d547f6d4cea624ad79d3efc77 --parallel=3nx run-many -t check-imports check-commit check-lock-files check-codeowners documentation --parallel=1 --no-dtenx-cloud record -- nx format:check --base=16008751ec1bec0066a3266be80d4bf6594ce548 --head=3e016191db81be3d547f6d4cea624ad79d3efc77nx documentation --no-dtenx affected -t e2e-macos-ci --parallel=1 --base=16008751ec1bec0066a3266be80d4bf6594ce548 --head=3e016191db81be3d547f6d4cea624ad79d3efc77
Sent with 💌 from NxCloud.
Why? Why is this not made optional (or at-least make this behavior opt in?), as a lib maintainer we add dev dependencies so that
- the package is available when we are developing
- we can import the package.json and copy it over if needed to the devDependencies of the users project
- we can use a tool like ncu to easy update set packages that are added to the users project
- we are then not forcing certain versions to our end users
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.