in watch mode, file change only triggers lib/types regenerate.
// tsup.config.js
import { defineConfig } from "tsup";
export default defineConfig((options) => {
return [
{
legacyOutput: true,
format: ["cjs"],
outDir: "lib",
},
{
legacyOutput: true,
dts: true,
outDir: "types",
format: [],
},
{
legacyOutput: true,
format: ["esm"],
outDir: ".",
},
];
});
tsup src --watch
> tsup src --watch
CLI Building entry: src/index.ts, src/server.ts
CLI tsup v6.2.3
CLI Using tsup config: /Users/sunqiang/ProjectSpace/capital/packages/core/tsup.config.ts
CLI Running in watch mode
CLI Target: node14
CLI Building entry: src/index.ts, src/server.ts
CLI tsup v6.2.3
CLI Using tsup config: /Users/sunqiang/ProjectSpace/capital/packages/core/tsup.config.ts
CLI Running in watch mode
CLI Target: node14
CLI Watching for changes in "."
CLI Ignoring changes in "**/{.git,node_modules}/**" | "types"
CLI Building entry: src/index.ts, src/server.ts
CLI tsup v6.2.3
CLI Using tsup config:tsup.config.ts
CLI Running in watch mode
CLI Target: node14
CJS Build start
ESM Build start
ESM esm/server.js 120.00 B
ESM esm/index.js 118.00 B
ESM ⚡️ Build success in 6ms
CLI Watching for changes in "."
CLI Ignoring changes in "**/{.git,node_modules}/**" | "."
CJS lib/server.js 1.07 KB
CJS lib/index.js 1.09 KB
CJS ⚡️ Build success in 8ms
CLI Watching for changes in "."
CLI Ignoring changes in "**/{.git,node_modules}/**" | "lib"
DTS Build start
DTS ⚡️ Build success in 315ms
CLI Change detected: change src/index.ts
DTS Build start
CJS Build start
CJS lib/server.js 1.07 KB
CJS lib/index.js 1.08 KB
CJS ⚡️ Build success in 3ms
DTS ⚡️ Build success in 183ms
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too