Skip to content

exports-field

Check that exports field exists in package.json

PropertyValue
Rule IDexports/exports-field
Categoryexports
Severity🔴 error
Fixable⚠️ Auto-fixable (unsafe)

What it Checks

The exports field is the modern way to define package entry points. Without it, consumers rely on legacy main/module fields which have ambiguous resolution behavior.

Examples

❌ Incorrect

json
{ "name": "my-pkg", "main": "./dist/index.js" }

✅ Correct

json
{ "name": "my-pkg", "exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } } }

Configuration

Disable this rule:

bash
tspub check --ignore-rules "exports/exports-field"

Or in tspub.config.ts:

typescript
export default {
  check: {
    severityOverrides: {
      "exports/exports-field": "off",  // or "warning", "error", "info"
    },
  },
};

Released under the MIT License.