Repository navigation
Public API for pre-rebuild veto or watcher substitution in Turbopack (dev) #96540
Replies: 2 comments
|
Built a runnable reproduction of the gap: https://github.com/GriffinCanCode/turbopack-noop-write-repro One Next.js 16.2.12 app, eight byte-identical writes to
The whole webpack-side integration is about thirty lines wrapping Two details from building it that bear on which API shape is best:
Happy to reshape any of this into an RFC, or to cut the repro down further if it's more useful smaller. |
|
Implemented it: #96575 Opt-in behind |
Uh oh!
There was an error while loading. Please reload this page.
Summary: Turbopack currently offers no public JS seam to observe which files changed in a watch pass, to substitute the underlying file watcher, or to veto a rebuild before it runs.
turbopack.rulescovers per-file loaders only. This blocks an entire class of dev-tooling — content-addressed watchers, no-op-write suppression, custom notification backends (e.g. Watchman on large monorepos, polling on network filesystems) — that webpack supports today via a settablecompiler.watchFileSystemand that Vite supports viaserver.watcher+handleHotUpdate.Request: Expose one of (in order of preference):
compiler.watchFileSystem), so an external watcher can be the sole source of change events.Any one of these unblocks the integration. (1) is the smallest.
Use case: We maintain a native content-hashing watcher that skips byte-identical rebuilds (a formatter-on-save, a generator that reran, a branch switch that restored identical contents). It integrates with webpack (
watchFileSystem), Vite, Rspack, Rollup, and esbuild. Turbopack is the only major bundler with no attachable seam, so Next.js users on Turbopack cannot get no-op-write suppression today and must fall back tobundler: 'webpack'.Prior art: webpack
compiler.watchFileSystem; Viteserver.watcher+handleHotUpdate; Rspackcompiler.watchFileSystemcompatibility.Filed as a Discussion because this is an API/feature request, not a bug: the bug-report issue form (#96520) is auto-closed for lacking a reproduction. Happy to move this to an RFC if that is the preferred venue for a public-API proposal.
All reactions