egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
8.49k stars 209 forks source link

Error `Invalid option in build() call: "watch"` from esbuild #1148

Open vHeemstra opened 5 days ago

vHeemstra commented 5 days ago

Problem

When running tsup or tsup-node with a config file (either the standard file name scheme or by setting --config with a file name), esbuild throws an error:

Invalid option in build() call: "watch"
// from node_modules\esbuild\lib\main.js:253:12

❌ The error is thrown:

All of these even with watch omitted, watch: false or watch: undefined inside the config file.

✔️ The error is not thrown:

Possible cause

So it seems the parsing of the options from a config file handles the watch option different from the CLI --watch argument. Resulting in a --watch argument added to the esbuild command, which is not allowed anymore (see release notes from esbuild).

Upvote & Fund

Fund with Polar