Replies: 3 comments 1 reply
-
|
We cannot change this until the next major version without it being a breaking change, so I think you'll need to find some sort of workaround for your problem. I'm converting this to a discussion for better longevity and searchability on the issue 🙂 |
Beta Was this translation helpful? Give feedback.
-
|
For anyone facing the same issue, I found a workaround by structuring exports of my package. I made sure that code importing CDK lib is exported via a separate export in |
Beta Was this translation helpful? Give feedback.
-
|
I don't understand - why would this be a breaking change? Why would adding a line for "./core" pointing to "./core/index.js" break things? The root (".") still points to "./index.js" so people would still be able to use the default export. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I think the suggested solution to use the default export is not satisfactory. I'm running into issues when bundlers scan dependencies and choke on things inside the
aws-cdk-libthat I don't even use (e.g. Dockerfile fromaws-cdk-lib/lambda-layer-kubectl/layer/Dockerfile🤷♂️ ), but they're still reachable from the bundler's perspective because my code importsaws-cdk-libdefault export which exports everything.Exporting
coreexplicitly would allow for better tree shaking in bundlers. Otherwiseaws-cdk-libobjectively still remains a monolithic CJS package and neglects benefits of ESM.Originally posted by @shishkin in #17950 (comment)
Beta Was this translation helpful? Give feedback.
All reactions