Skip to content

Instantly share code, notes, and snippets.

@youyoumu
Created March 1, 2025 12:04
Show Gist options
  • Save youyoumu/c93d8242e8373a12d491b8cae1cb8bd2 to your computer and use it in GitHub Desktop.
Save youyoumu/c93d8242e8373a12d491b8cae1cb8bd2 to your computer and use it in GitHub Desktop.
tsup.config.ts
import { spawnSync } from "child_process";
import { defineConfig } from "tsup";
export default defineConfig((options) => ({
entry: ["src/**/*.{ts,tsx}"],
format: "esm",
outDir: "dist",
splitting: false,
outExtension() {
return {
js: `.js`,
};
},
async onSuccess() {
spawnSync("tsc", ["--emitDeclarationOnly"]);
console.log("✅ declaration files generated");
},
...options,
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment