You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Call build:prepare hook on rebuild in watch mode #972
When running in watch mode, tsdown currently only calls the build:done hook on each rebuild. The build:prepare hook is never invoked after the initial build.
This makes it difficult to adopt tsdown in projects that require code generation before building — for example, those using graphql-codegen. Since build:prepare is the natural place to trigger such pre-build steps, skipping it on rebuilds means generated code becomes stale during development.
Suggested solution
Invoke the build:prepare hook at the start of each rebuild cycle in watch mode, just as it is called before the initial build.
Alternative
Expose a dedicated watch-specific hook (e.g. watch:rebuild) that fires before each rebuild, so users can run pre-build tasks without relying on build:prepare semantics.
Additional context
Tools like graphql-codegen need to run before TypeScript compilation to produce up-to-date type definitions. Without build:prepare being called on each rebuild, developers lose the hot-reload experience that watch mode is meant to provide, and must resort to running a separate watcher process in parallel.
Activity