sxzz / tsdown

An even faster bundler powered by Rolldown.
https://jsr.io/@sxzz/tsdown
MIT License
308 stars 5 forks source link

watch build is not working #35

Open ryoppippi opened 1 week ago

ryoppippi commented 1 week ago

Describe the bug

When we use tsdown watch mode and save some file while tsdown running, the tsdown craches.

/t/merge-sx master• 2.2s ❱ bun tsdown --watch
ℹ tsdown v0.2.15 powered by rolldown v0.13.2                                                                                                                                                                                                                                                          tsdown 6:48:50 PM
ℹ Using tsdown config: /private/tmp/merge-sx/tsdown.config.ts                                                                                                                                                                                                                                         tsdown 6:48:51 PM
ℹ entry: src/index.ts                                                                                                                                                                                                                                                                                 tsdown 6:48:51 PM
ℹ Cleaning output folder                                                                                                                                                                                                                                                                              tsdown 6:48:51 PM
✔ Build complete in 7ms                                                                                                                                                                                                                                                                               tsdown 6:48:51 PM
ℹ Watching for changes in /private/tmp/merge-sx                                                                                                                                                                                                                                                       tsdown 6:48:51 PM
ℹ Change detected: change /private/tmp/merge-sx/src/index.ts                                                                                                                                                                                                                                          tsdown 6:48:54 PM
node:internal/process/promises:391
    triggerUncaughtException(err, true /* fromPromise */);
    ^

[Error: Failed to lock the bundler. Is another operation in progress?] {
  code: 'GenericFailure'
}

Node.js v22.3.0
error: "tsdown" exited with code 1

Reproduction step

I'll use tsdown in some projects, but I'll choose @RobinTail 's merge-sx as a minimal example.

  1. git clone https://github.com/RobinTail/merge-sx
  2. bun install
  3. bun install tsdown@latest
  4. bun run tsdown --watch
  5. open src/index.ts and save file with/without changes.
  6. tsdown crashes

This also happenes in pnpm

Reproduction

See ↑

System Info

System:
    OS: macOS 14.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 408.98 MB / 36.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 22.3.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/node
    npm: 10.8.1 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/npm
    pnpm: 9.8.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/pnpm
    bun: 1.1.26 - ~/.local/share/aquaproj-aqua/bin/bun
  Browsers:
    Chrome: 128.0.6613.121
    Safari: 17.5


### Used Package Manager

pnpm

### Validations

- [X] Follow our [Code of Conduct](https://github.com/sxzz/.github/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guide](https://github.com/sxzz/contribute).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
sxzz commented 1 week ago

Seems like this is caused by upstream (rolldown)

sxzz commented 1 week ago

File an issue on upstream https://github.com/rolldown/rolldown/issues/2213

ryoppippi commented 1 week ago

Thanks!!