I am using node 14 with npm 6 where the bundledDependencies should be supported.
I am trying to have this setup:
- package-C is the bundled dependency of package-B
- package-B is the dependency of package-A
then I expect I can use APIs exposed by package-C when developing package-A without having package-C as the dependency or devDependency in package-A's package.json.
However, this is not working as require.resolve("package-C") throws "Cannot find module" error under package-A.
Then I check the package-lock.json of package-A and I don't see any dependencies listed under package-B entry (I am trying to check if package-B -> package-C has bundled set as true or not).
{
"name": "package-A",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"package-B": {
"version": "1.0.0"
// I am wishing to see something like the following but there is not:
// "dependencies": {
// "package-C": {
// "version": "1.0.0",
// "bundled": true
// }
// }
}
}
}
During the npm pack of package-B, however, I do see the following output indicating package-C being bundled:
npm notice
npm notice package-B
npm notice === Tarball Contents ===
npm notice redacted
npm notice === Bundled Dependencies ===
npm notice package-C
npm notice === Tarball Details ===
npm notice name: package-B
npm notice version: 1.0.0
npm notice package size: 17.7 MB
npm notice unpacked size: 127.5 MB
npm notice shasum: redacted
npm notice integrity: redacted
npm notice bundled deps: 1
npm notice bundled files: 4142
npm notice own files: 18
npm notice total files: 4160
npm notice
Can someone help?