Open elmerbulthuis opened 10 months ago
@elmerbulthuis
I am also facing the same issue with latest version of node.js, the buldeled dependencies are being ignored/ not considered while building the node package. however I don't face same issue with the lower version of node.js like 16.18.1.
I am using npm pack command to have locally installble tarball file.
npm pack release-folder
the package.json look's like this release-folder look's like this -
"peerDependencies": { "@angular/common": "^13.3.0", "@angular/core": "^13.3.0", "@angular/platform-browser": "~13.3.0", "@angular/forms": "~13.3.0", "@core-3d": "1.0.2", "@loader": "1.0.2", "@viewer": "1.0.2", "@shared-ui": "0.0.1" }, "dependencies": { "tslib": "^2.3.0" }, "bundledDependencies": [ "@core-3d", "@loader", "@viewer", "@shared-ui" ]
Let me know if you were able to fix the problem at your end.
Thank you !!
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I have a monorepo that is setup similar something like this
The
package.json
in the root looks something like this:The
packages/main/package.json
looks something like thisWhen I do a
npm --workspace main pack
then dependency1 and dependenc2 are not bundled!Expected Behavior
I would love to see the dependencies bundled in the package. I have a workaround that does exactly what I want:
the
packages/main/package.json
:the
packages/main/prepack
:for some reason I had to clean the node_modules folder so that only the dependencies i want to be bundled are in there. If i don't it will bundle everything in the node_modules folder. This is kind of weird as i specify what i want in the bundledDependencies key
Steps To Reproduce
Create a monorepo setup with two packages in it. One of the packages is a depencendy of the other. The dependency should be in the bundledDependencies list of the main package. Also, in main package and in the root package include a dependency that has a differnt major value. This will make the package appear in the node modules folder of the main package when installing.
Then npm pack the main packages using the --workspace parameter and voila! the dependent package will nog be in the produces .tgz file.
Environment
npm: 10.3.0
Node.js: v21.5.0
OS Name: arch linux
System Model Name: something home made
npm config:
//registry.npmjs.org/:_authToken = (protected)
; "project" config from /home/elmerbulthuis/workspace/JsonSchema42/.npmrc
commit-hooks = false git-tag-version = false
; node bin location = /usr/bin/node ; node version = v21.5.0 ; npm local prefix = /home/elmerbulthuis/workspace/JsonSchema42 ; npm version = 10.3.0 ; cwd = /home/elmerbulthuis/workspace/JsonSchema42 ; HOME = /home/elmerbulthuis ; Run
npm config ls -l
to show all defaults.