Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Reference aws-cdk-lib and constructs as peer and dev dependencies so that they are not unnecessarily get bundled #996

Closed
wants to merge 1 commit into from

Conversation

xiongbo-sjtu
Copy link
Collaborator

@xiongbo-sjtu xiongbo-sjtu commented Dec 23, 2024

What's the problem

As part of the investigation for an issue with aws-cdk, I find that aws-cdk-lib and constructs are bundled up since they're specified as dependencies of cdk-ecr-deployment. Searching for P181556369 in the internal ticketing system for details.

$ls -lht  node_modules/@amzn/amzn-cdk-ecr-deployment/node_modules/
total 0
drwxr-xr-x@ 291     10K Dec  8 20:14 aws-cdk-lib
drwxr-xr-x@   6    476B Dec  8 20:14 cdk-ecr-deployment
drwxr-xr-x@   3    476B Dec  8 20:14 constructs
drwxr-xr-x@   6    204B Dec  8 20:14 @aws-cdk

Proposed Solution

Reference aws-cdk-lib and constructs as peer and dev dependencies so that they are not unnecessarily get bundled.

The following example illustrates that PeerDependencies are not automatically bundled.

  • my-app bundles package-a and package-b because they are part of the dependency tree.
  • package-c (a peerDependency) is not bundled unless explicitly added to bundledDependencies in my-app.

package.json of an app

{
  "name": "my-app",
  "version": "1.0.0",
  "dependencies": {
    "package-a": "^1.0.0"
  },
  "bundledDependencies": ["package-a"]
}

package-a/package.json

{
  "name": "package-a",
  "version": "1.0.0",
  "peerDependencies": {
    "package-c": "^2.0.0"
  },
  "dependencies": {
    "package-b": "^1.0.0"
  }
}

auto-merge was automatically disabled December 23, 2024 23:20

Head branch was pushed to by a user without write access

@xiongbo-sjtu xiongbo-sjtu force-pushed the main branch 2 times, most recently from a838871 to 774b8fc Compare December 23, 2024 23:22
…es so that they are not unnecessarily get bundled
@kaizencc
Copy link
Contributor

superseeded by #998

@kaizencc kaizencc closed this Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants