-
-
Notifications
You must be signed in to change notification settings - Fork 144
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Reproduction link or steps
- Create a tsdown config:
import { defineConfig } from 'tsdown'
export default defineConfig({
entry: ['./src/index.ts'],
format: ['esm'],
unbundle: true,
dts: true,
exports: {
devExports: true,
},
})- Create this file structure:
src/
index.ts
components/
text/
index.ts
- Run
tsdown. It outputs: dist/
index.js
components/
text/
index.js
- Check
package.json. Only main export is generated:
{
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
}
}What is expected?
devExports: true should generate subpath exports for each unbundled module:
{
"exports": {
".": "./src/index.ts",
"./text": "./src/components/text/index.ts"
},
"publishConfig": {
"exports": {
".": "./dist/index.js",
"./text": "./dist/components/text/index.js"
}
}
}What is actually happening?
Only the main . export is generated. Consumers can't import individual unbundled modules:
// Doesn't work - no subpath export defined
import { Text } from '@my-lib/text'
// Only this works - defeats the purpose of unbundling
import { Text } from '@my-lib'Any additional comments?
This makes it hard to build component libraries following modern patterns (Base UI, Radix UI, etc.) where each component is individually importable for better tree-shaking.
Current workaround is setting exports: false and manually maintaining all subpath exports, but that defeats the purpose of devExports: true.
When unbundle: true, it would be useful if devExports scanned the output structure and auto-generated subpath exports.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request