Skip to content

Commit

Permalink
Add directory exports module suffix (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie authored Jul 17, 2023
1 parent c2b3f1b commit cd4bb0f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/lazy-eggs-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'typechain': patch
---

Add the node16 moduleSuffix also to directories (including the `index` filename) as in ESM directory root files have to
be explicitly stated (including their file extension).
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
/* tslint:disable */
/* eslint-disable */
export type { Dai } from "./Dai.js";
export * as factories from "./factories";
export * as factories from "./factories/index.js";
export { Dai__factory } from "./factories/Dai__factory.js";
3 changes: 3 additions & 0 deletions packages/typechain/src/codegen/createBarrelFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export function createBarrelFiles(
`export type { ${namespaceIdentifier} };`,
].join('\n')

if (moduleSuffix) {
return `export * as ${namespaceIdentifier} from './${p}/index${moduleSuffix}';`
}
return `export * as ${namespaceIdentifier} from './${p}';`
})
.join('\n')
Expand Down

0 comments on commit cd4bb0f

Please sign in to comment.