Description
Describe the bug
When using the CDK with pnpm it is prone to have package hoisting issues as all the packages are declared as devDependencies
not dependencies
. Looking at
https://unpkg.com/[email protected]/package.json
I am seeing all dependencies have been moved to devDependencies
however in the code itself it looks like there are normal dependencies
(https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/package.json#L94).
When these are only declared as dev pnpm is not hoisting the dependency (as it is not declared as one that is needed to use the package), which causes aws-cdk
to load [email protected]
instead of [email protected]
if there is another package in the monorepo that has a hard dependency on [email protected]
.
Expected Behavior
Dependencies and devDependencies should be maintained in the released npm package indicating packages needed to use the cdk vs packages just needed when developing it.
Current Behavior
All dependencies are merged into devDependencies
when released
Reproduction Steps
Create a pnpm workspace where the main package.json
depends on lint-staged
as well as aws-cdk
. Attmepting to use the cdk will result in yaml errors when trying to use yaml/types
for example.
Possible Solution
Maintain dependencies when released.
Additional Information/Context
Workaround for this is to add the following to your pnpm config in paclage.json
"aws-cdk": {
"dependencies": {
"yaml": "1.10.2"
}
}
CDK CLI Version
n/a
Framework Version
No response
Node.js Version
16
OS
WSL/Ubuntu
Language
Typescript
Language Version
No response
Other information
No response