web-infra-dev / web-infra-dev/rslib
[Feature]: `dts.only`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 67
- Avg merge
- 6h 9m
- Merged PRs (30d)
- 57
Description
What problem does this feature solve?
before
I have three tasks 1. bundle-node 2. bundle-web 3. bundleless-dts, but i have to define 3 tasks into 2
export default defineConfig({
lib: [
{
source: {
entry: {
index: './src/index.ts',
},
},
dts: true, // <--------- in this line
format: 'esm',
syntax: 'esnext',
},
{
source: {
entry: {
index: './src/runtime/index.ts',
},
},
format: 'esm',
syntax: 'esnext',
plugins: [pluginReact()],
output: {
externals: [
'@theme',
'react',
'react/jsx-runtime',
'react/jsx-dev-runtime',
],
target: 'web',
},
},
],
});
after
lib: [
// js only
{
source: {
entry: ''
}
},
// js only 2
{
source: {
entry: ''
}
},
// dts only
{
dts: {
only: true
}
}
]
What does the proposed API look like?
https://modernjs.dev/module-tools/api/config/build-config.html#dtsonly
Some drawbacks
We suggest that esm and cjs each have their own dts files, but in this way, we can share the same dts files for both esm and cjs.
This is actually a misuse, which is easy to lead users to incorrect usage.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the example configuration in packages/plugin-algolia/rslib.config.ts and compare the proposed dts.only API with the linked Modern.js documentation. Determine how the configuration should represent JavaScript-only and declaration-only tasks, then verify that the resulting build setup supports the stated shared-d.ts use case and its documented drawbacks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100