Skip to content

Interface: ExportsOptions

Defined in: src/features/pkg/exports.ts:20

Properties

all?

ts
optional all: boolean;

Defined in: src/features/pkg/exports.ts:37

Exports for all files.


customExports?

ts
optional customExports:
  | Record<string, any>
| (exports, context) => Awaitable<Record<string, any>>;

Defined in: src/features/pkg/exports.ts:82

Specifies custom exports to add to the package exports in addition to the ones generated by tsdown. Use this to add additional exports in the exported package, such as workers or assets.

Examples

ts
customExports(exports) {
  exports['./worker.js'] = './dist/worker.js';
  return exports;
}
jsonc
{
  "customExports": {
    "./worker.js": {
      "types": "./dist/worker.d.ts",
      "default": "./dist/worker.js",
    },
  },
}

devExports?

ts
optional devExports: string | boolean;

Defined in: src/features/pkg/exports.ts:26

Generate exports that link to source code during development.

  • string: add as a custom condition.
  • true: all conditions point to source files, and add dist exports to publishConfig.

exclude?

ts
optional exclude: (string | RegExp)[];

Defined in: src/features/pkg/exports.ts:48

Specifies file patterns (as glob patterns or regular expressions) to exclude from package exports. Use this to prevent certain files from being included in the exported package, such as test files, binaries, or internal utilities.

Note: Do not include file extensions, and paths should be relative to the dist directory.

Example

ts
exclude: ['cli', '**/*.test', /internal/]

inlinedDependencies?

ts
optional inlinedDependencies: boolean;

Defined in: src/features/pkg/exports.ts:100

Generate inlinedDependencies field in package.json. Lists dependencies that are physically inlined into the bundle with their exact versions.

Default

ts
true

See

https://github.com/e18e/ecosystem-issues/issues/237


legacy?

ts
optional legacy: boolean;

Defined in: src/features/pkg/exports.ts:58

Generate legacy fields (main and module) for older Node.js and bundlers that do not support package exports field.

Defaults to false, if only ESM builds are included, true otherwise.

See

https://github.com/publint/publint/issues/24


packageJson?

ts
optional packageJson: boolean;

Defined in: src/features/pkg/exports.ts:32

Exports for package.json file.

Default

ts
true

Released under the MIT License.