egoist / egoist/tsup

watch mode does not regenerate esm format

Open
#711 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

in watch mode, file change only triggers lib/types regenerate.

## config
```js
// 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: ".",
},
];
});
```
### command
```sh
tsup src --watch
```

## output
```bash
> 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
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with tsup src --watch using the shown tsup.config.js and the src/index.ts and src/server.ts entries. Change a source file and compare the CJS, DTS, and ESM outputs; done means the ESM output regenerates alongside lib and types.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.