Skip to content

Commit

Permalink
fix: imports from ESM modules cannot find correct type definitions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgrain committed Jan 27, 2023
1 parent 070f5ec commit 356a128
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/package.json
Expand Up @@ -407,6 +407,7 @@
},
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./lazy-index.js"
},
Expand Down
2 changes: 2 additions & 0 deletions tools/@aws-cdk/ubergen/bin/ubergen.ts
Expand Up @@ -48,6 +48,7 @@ interface LibraryReference {
}

type Export = string | {
readonly types?: string;
readonly import?: string;
readonly require?: string;
};
Expand Down Expand Up @@ -275,6 +276,7 @@ async function prepareSourceFiles(libraries: readonly LibraryReference[], packag
// allowed for this package: we only want to allow the exact import statements that we want to support.
packageJson.exports = {
'.': {
types: './index.d.ts',
import: './index.js',
require: './lazy-index.js',
},
Expand Down

0 comments on commit 356a128

Please sign in to comment.