Declaration files don't work with multiple entrypoints
See original GitHub issueThis is my tsup
config:
"tsup": {
"splitting": false,
"sourcemap": true,
"clean": true,
"dts": true,
"format": [
"esm",
"cjs"
],
"entryPoints": [
"src/index.ts",
"src/cli/index.ts"
]
},
When I run build, the file dist/index.d.ts
only has #!/usr/bin/env node
as contents (even though this is not the CLI declaration file), nothing else. There is no file dist/cli/index.d.ts
. If I run it with only a single entrypoint: src/index.ts
, the dist/index.d.ts
file is generated properly to correspond to src/index.ts
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Exporting declarations for library with multiple entry points
Let's say I'm exporting a library with a file structure like |__ src | |__ index.
Read more >Bundling with Rollup & multiple entry points - Reddit
So, I'm using Rollup and currently just letting ESBuild output my bundle and Typescript exports .d.ts typing files according to the original ...
Read more >tsup
Files are written into ./dist . You can bundle multiple files in one go: tsup src/index.ts src/cli.ts. This will output dist/index.js and dist/cli.js...
Read more >Multiple entry points in create-react-app without ejecting
You can create multiple entry points in create-react-app without ejecting by using an environment variable to conditionally import container ...
Read more >EntryPoints - Traefik Labs documentation
They can be defined by using a file (YAML or TOML) or CLI arguments. ... If both TCP and UDP are wanted for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Found a workaround:
This will create a
dist/cli/index.d.ts
file as well as adist/index.d.ts
fileMy workaround for this issue is this:
tsc -b
to generate .d.ts and .js files with CommonJS syntax.esbuild
to generate ES modules with.mjs
extension.