What problem does this feature solve?
Currently, rslib aims for a zero-configuration experience by treating package.json as the single source of truth (see #62).
However, since rslib does not exclude *.test.ts files by default, it’s difficult to achieve a truly configuration-free setup.
To improve this, it would be helpful to introduce an option that automatically generates the following fields in package.json based on the build entries:
- main
- module
- types
- exports
This would make the build output and package metadata consistent without requiring manual edits to package.json.
For reference, tools like tsdown already provide a similar feature that derives these fields from the build entry configuration.
Implementing something comparable in rslib would simplify the developer experience and reduce maintenance overhead.
What does the proposed API look like?
import { defineConfig } from '@rslib/core'
export default defineConfig({
output: {
exports: true,
},
})
When enabled, rslib automatically generates exports, main, module, and types fields in package.json based on the build entries.
What problem does this feature solve?
Currently,
rslibaims for a zero-configuration experience by treatingpackage.jsonas the single source of truth (see #62).However, since
rslibdoes not exclude*.test.tsfiles by default, it’s difficult to achieve a truly configuration-free setup.To improve this, it would be helpful to introduce an option that automatically generates the following fields in
package.jsonbased on the build entries:This would make the build output and package metadata consistent without requiring manual edits to
package.json.For reference, tools like
tsdownalready provide a similar feature that derives these fields from the build entry configuration.Implementing something comparable in
rslibwould simplify the developer experience and reduce maintenance overhead.What does the proposed API look like?
When enabled,
rslibautomatically generatesexports,main,module, andtypesfields in package.json based on the build entries.