Skip to content

esm-main-no-exports

Warn when "main" is ESM but "exports" is missing

PropertyValue
Rule IDexports/esm-main-no-exports
Categoryexports
Severity🟡 warning
FixableNo

What it Checks

When "main" points to an ESM file but the "exports" field is missing, older bundlers and Node.js versions may not resolve the entry correctly. Adding an "exports" map ensures consistent resolution.

Configuration

Disable this rule:

bash
tspub check --ignore-rules "exports/esm-main-no-exports"

Or in tspub.config.ts:

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

Released under the MIT License.