nx
nx copied to clipboard
@nx/rollup does not pick up exact version of root package.json dependencies
Current Behavior
If I have a library dependency - a@^1.0.0 in root package.json, after build using @nx/rollup bundler, the version is picked up partially with 1.0.0 instead of ^1.0.0 which would cause some potential upgrade issue when I try to consume this component in other applications.
{
//...
"dependencies": {
"a": "1.0.0",
},
}
Just to compare, for another component I wrote, executor @nx/js:tsc is used as it is pure typescript library, the version is picked up correctly with ^1.0.0.
Expected Behavior
The dependency version in my publishable component bundle should be:
{
//...
"dependencies": {
"a": "^1.0.0",
},
}
GitHub Repo
No response
Steps to Reproduce
-
Generate a component using:
npx nx g @nx/react:library ${COMPONENT_NAME} --bundler=rollup --style="styled-components" --publishable --importPath="@myOrg/${COMPONENT_NAME}" -
Define build executor for this library using:
"executor": "@nx/rollup:rollup",
"options": {
// ...
"external": "all",
"buildableProjectDepsInPackageJsonType": "dependencies",
"updateBuildableProjectDepsInPackageJson": true,
// ...
}
-
Write code with global dependency defined in root package.json.
-
Run
npx nx run component:build. -
Check the
package.jsonfile indistfolder bundle resources.
Nx Report
Node : 16.19.0
OS : darwin arm64
npm : 8.19.3
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/cypress : 16.3.2
@nx/devkit : 16.3.2
@nx/eslint-plugin : 16.3.2
@nx/express : 16.3.2
@nx/next : 16.3.2
@nx/node : 16.3.2
@nx/react : 16.3.2
@nx/rollup : 16.3.2
@nx/storybook : 16.3.2
@nrwl/tao : 16.3.2
@nx/web : 16.3.2
@nx/webpack : 16.3.2
nx-cloud : 16.0.5
typescript : 5.0.4
---------------------------------------
Community plugins:
@jscutlery/semver : 3.0.0
---------------------------------------
Failure Logs
No response
Operating System
- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response
@mandarini any update on this? Thanks!
@davidren-apt no sorry, no updates yet :( I will try to see if anyone has time to look at it this week, or else I can take a look next week maybe! Have you managed to find any workarounds, maybe?
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
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.