High CPU due to file watcher for app dev command

I have reproduced the issue on the latest CLI version.

Yes, I am on the latest version

I have searched existing posts and this report is not a duplicate.

Yes, this isn’t a duplicate

In which of these areas are you experiencing a problem?

App

Expected behavior

Running shopify app dev should idle near 0% CPU after startup.

Actual behavior

The shopify app dev CLI process (node …/bin/shopify app dev) consumes about 200% CPU continuously after startup, for the entire lifetime of the command. All child processes it spawns (vite, artisan serve, etc.) sit near 0% CPU. The CPU is consumed by the CLI process itself.

My analysis: @shopify/cli 4.9.4 bundles chokidar 3.6.0 into its dist/ but does not ship the fsevents native module it loads via try { require("fsevents") }, so on macOS chokidar silently falls back to fs.watchFile()-based polling. Build dirs like extensions/*/target (~89k-total ~29k cargo-generated files in my app, only node_modules/.git are ignored in packages/app/…/app-events/file-watcher.ts) then get stat-polled ~289k times/second, saturating all 4 libuv fs threads.

Fix hints:

  • Ship fsevents: add it to the external list in packages/cli/bin/bundle.js
    and to @shopify/cli’s optionalDependencies.
  • Or ignore **/target/** (or the extension .gitignore) in the file watcher
    so build output isn’t watched.

Reproduction steps

  1. On macOS (Apple Silicon), install @shopify/cli globally: npm i -g @shopify/cli
  2. Use an app containing Shopify Functions built with Rust: after a build the
    extensions//target/ directories contain ~5,000–13,000 files each.
  3. Run shopify app dev and observe the shopify process in Activity Monitor
    or ps -axo time,%cpu,command: it shows ~200%+ CPU continuously while
    the child dev-server processes idle at ~0%.

Verbose output

(Output contains unrelated error fetching app logs)

Relevant output, I can provide the full output if necessary:

2026-10-21T07:53:02.277Z: Building function discount-ignoring-fees...
2026-10-21T07:53:02.280Z: Building function cart-transformer...
2026-10-21T07:53:02.285Z: Building function cart-validation...
2026-10-21T07:53:02.611Z: Reading the content of file at extensions/theme-extension/assets/…
2026-10-21T07:53:02.609Z: Reading the content of file at extensions/discount-ui/dist/discount-ui.js...
2026-10-21T07:53:04.154Z: Sync-reading the content of file at extensions/cart-validation/target/wasm32-unknown-unknown/release/cart-validation.optimized.wasm...
2026-10-21T07:53:04.305Z: Sync-reading the content of file at extensions/discount-ignoring-fees/target/wasm32-unknown-unknown/release/order-discount-ignoring-fees.optimized.wasm...
2026-10-21T07:53:04.511Z: Sync-reading the content of file at extensions/cart-transformer/target/wasm32-unknown-unknown/release/cart-transformer.optimized.wasm...
2026-10-21T07:53:04.769Z: Applying trampoline to the wasm binary with command: …/shopify-function-trampoline-2.0.1 -i …/extensions/…/target/wasm32-unknown-unknown/release/*.optimized.wasm -o …
2026-10-21T07:53:04.958Z: Converting WASM from extensions/<function>/target/wasm32-unknown-unknown/release/*.optimized.wasm to base64 in .shopify/dev-bundle/<uuid>/dist/index.wasm
2026-10-21T07:53:05.154Z: Import scan for "pos-fee-tile": 1 entries, 15 files, 2ms (cache: 15 parsed, 45 stats)
2026-10-21T07:53:05.156Z: Import scan for "discount-ui": 1 entries, 11 files, 1ms (cache: 26 parsed, 82 stats)
2026-10-21T07:53:05.158Z: File watcher started with 153 paths
2026-10-21T07:53:05.158Z: Function extensions detected, starting logs polling
2026-10-21T07:53:06.896Z: Sync-reading the content of file at .shopify/dev-bundle.br...
✅ Ready, watching for changes in your app │ Access scopes auto-granted: …

Operating system

macOS 15.7.9, Apple Silicon (arm64)

CLI version

4.9.4

Shell

zsh 5.9

Nodejs version

v22.23.2

What language and version are you using in your application?

PHP 8.4 (Laravel 12), TypeScript/React (Vite 8), Rust (Shopify Functions)

Hi @Tobias_Dierich, I reproduced the polling behaviour in an isolated macOS test using CLI 4.9.4’s bundled watcher. Disabling polling reduced idle CPU while source-file changes were still detected.

Could you try this as a temporary workaround?

CHOKIDAR_USEPOLLING=false shopify app dev

This uses Chokidar’s polling override. Does it bring the CLI process’s CPU usage down, and do edits to your Rust source files still trigger a rebuild?

Hey @Yoni-Shopify ,

thank you for checking on this issue. Using `CHOKIDAR_USEPOLLING=false shopify app dev` does not work for me, unfortunately. It does indeed bring down CPU usage but changes to the rust extensions are only randomly picked up after a minute or two and always fail. Without this flag changes are picked up immediately and do not fail.

However, I do have a workaround that patches fsevents into the cli manually. So I am fine in that regard. But would love not to have to manually patch the CLI after every update :smiley:

Best
Tobias

Thanks for testing that, Tobias. I’ve shared your findings and test results with the CLI team and asked them to look at a permanent fix so you don’t need to keep patching after updates.

I’ll update this thread when I hear more.

Hi @Tobias_Dierich following up with an update: Shopify CLI 5.0.0 includes a fix that keeps Rust build output out of the file watcher.

Could you update and try shopify app dev without the manual fsevents patch or the CHOKIDAR_USEPOLLING override? Let me know whether CPU usage settles down and Rust changes trigger rebuilds reliably.

Hey @Yoni-Shopify. Thank you for the update. I can confirm that upgrading to cli 5.0.0 fixes the high CPU usage. Changes to the Rust function trigger a rebuild pretty much immediately.

Thank you :folded_hands: