A shareable tsdown configuration.
Install this package as a dependency in the project:
# npm
npm i @apst/tsdown
# Yarn
yarn add @apst/tsdown
# pnpm
pnpm add @apst/tsdown
# Bun
bun add @apst/tsdownImplement the preset into tsdown.config.ts:
import { defineConfig } from "@apst/tsdown";
import {
esmPreset,
cjsPreset,
dtsPreset,
} from "@apst/tsdown/presets";
export default defineConfig(
{
entry: {
index: "./src/index.ts",
},
},
[
esmPreset(),
cjsPreset(),
dtsPreset(),
],
);With IIFE output:
import type { UserConfig } from "tsdown";
import { defineConfig } from "@apst/tsdown";
import {
esmPreset,
cjsPreset,
dtsPreset,
iifePreset,
} from "@apst/tsdown/presets";
const options: UserConfig = {
entry: {
index: "./src/index.ts",
},
};
const iifeOptions: UserConfig = {
entry: {
init: "./src/init.ts",
},
noExternal: [
/** ... */
],
};
export default defineConfig([
esmPreset(options),
cjsPreset(options),
dtsPreset(options),
iifePreset(iifeOptions),
]);For the APIs, please refer to the APIs.
This project is licensed under the terms of the MIT license.