[CLI] Type generation for UI extensions reads too many files: restrict scanner to tsconfig.include or TOML entry

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?

Extension

Expected behavior

The recursive scanner should stop at a sensible boundary. Some possible options:

  • Stop traversal at files outside the extension directory (or outside paths declared in the extension’s own tsconfig.include).
  • Stop traversal at files that are not directly referenced in the extension’s TOML (module, or extension_points list).
  • Potentially, also add an opt-out or allow user-configurable boundaries.

The current behavior makes sense for gathering type information for extension entry points, but going beyond files actually described in the TOML or root-level extension config likely provides diminishing returns and can introduce massive performance penalties.

Suggested Fix

Either:

  • Honor the extension’s tsconfig.include boundary for what is checked.
  • Or, only recursively scan files within the extension’s directory.
  • Or, stop at files that are not directly referenced in extension_points/module in the TOML.
  • Or, provide an escape hatch for end users when they do want broader graph scans.

The intention is to reduce performance impact and limit graph walking (and Sync-reads) to only files the developer intends to be part of the extension’s public API.

Actual behavior

The CLI recursively loads all imported files in the dependency graph beginning with every UI extension entry point when generating shopify.d.ts for Remote DOM UI extensions (those with api_version >= 2025-10). This traversal can end up reading (with Sync-reading the content of file at ...) every single file that is directly or indirectly imported, including shared libraries, workspace-owned code, and other 1st-party packages, depending on the structure of imports and tsconfig.json aliases.

For large apps with shared monorepo dependencies, this can become extremely expensive and (in some cases) disrupt build or dev performance. At worst, it creates the effect that the type generator is “looping” or crawling the entire repository, when it should really be project-scoped to just what’s needed for type safety in the extension itself.

See code:

Reproduction steps

  • Ship a UI extension with many workspace-shared files (e.g., source files in a monorepo)
  • Point the extension to an entry module through TOML
  • Run shopify app build (with a recent api_version, >=2025-10)
  • Observe the debug output: the CLI will sync-read every reachable file, even transitively.

Verbose output

2026-06-07T16:48:55.555Z: Looking for a lockfile in REDACTED
2026-06-07T16:48:55.559Z: Getting current session ID...
2026-06-07T16:48:55.565Z: Getting current session ID...
2026-06-07T16:48:55.873Z: Request to https://monorail-edge.shopifysvc.com/v1/produce completed in 302 ms
With response headers:
 - x-request-id: 26e4f552-5509-445e-82d2-e02ee051b843

2026-06-07T16:48:55.873Z: Analytics event sent: REDACTED
2026-06-07T16:48:55.878Z: Completed command app build
2026-06-07T16:48:55.887Z: Auto-upgrade: No newer version available.
11:50 AM  npm run shopify app build -- -- --verbose

> REDACTED@1.0.0 shopify
> shopify app build --verbose

2026-06-07T16:50:41.057Z: Running command app build
2026-06-07T16:50:41.071Z: Running system process:
  · Command: C:\nvm4w\nodejs\node.exe D:\REDACTED\node_modules\@shopify\cli\bin\run.js notifications list --ignore-errors
  · Working directory: D:/REDACTED

2026-06-07T16:50:41.088Z: Notifications to show: 0
2026-06-07T16:50:41.112Z: Reading the content of file at shopify.app.REDACTED.toml...
2026-06-07T16:50:41.113Z: Reading the content of file at shopify.app.REDACTED.toml...
2026-06-07T16:50:41.113Z: Reading the content of file at shopify.app.REDACTED.toml...
2026-06-07T16:50:41.113Z: Reading the content of file at shopify.app.REDACTED.toml...
2026-06-07T16:50:41.121Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.122Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.122Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.122Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.122Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.122Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.122Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.123Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.123Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.123Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.123Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.123Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.123Z: Reading the content of file at extensions/REDACTED/shopify.extension.toml...
2026-06-07T16:50:41.183Z: Reading the content of file at shopify.web.toml...
2026-06-07T16:50:41.184Z: Looking for a lockfile in REDACTED
2026-06-07T16:50:41.184Z: Reading the content of file at package.json...
2026-06-07T16:50:41.185Z: Reading the content of file at package.json...
2026-06-07T16:50:41.186Z: Reading the .env file at .env
2026-06-07T16:50:41.186Z: Reading the .env file at .env.prod
2026-06-07T16:50:41.186Z: Reading the .env file at .env.staging
2026-06-07T16:50:41.187Z: Reading the content of file at .env...
2026-06-07T16:50:41.187Z: Reading the content of file at .env.prod...
2026-06-07T16:50:41.187Z: Reading the content of file at .env.staging...
2026-06-07T16:50:41.188Z: Reading the content of file at .shopify/project.json...
2026-06-07T16:50:41.189Z: Reading cached app information for directory REDACTED
2026-06-07T16:50:41.192Z: Reading the content of file at .gitignore...
2026-06-07T16:50:41.209Z: Notifications to show: 0
2026-06-07T16:50:41.351Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.383Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.393Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.405Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.415Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.421Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.428Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.435Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.718Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:41.998Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:42.266Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:42.519Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:42.771Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.016Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.268Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.276Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.285Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.530Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.780Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.787Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.790Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:43.798Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:44.041Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:44.284Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:44.531Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:44.536Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:44.542Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:44.549Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:44.791Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:45.036Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:45.288Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:45.531Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:45.984Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:46.227Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:46.472Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:46.715Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:46.954Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:47.191Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:47.434Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:47.675Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:47.917Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:48.155Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:48.403Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:48.648Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:48.888Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:49.132Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:49.385Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:49.629Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:49.875Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:50.116Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:50.363Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:50.605Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:50.848Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:51.093Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:51.335Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:51.578Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:51.829Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:52.071Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:52.313Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:52.560Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:52.804Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:53.046Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:53.296Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:53.538Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:53.781Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:54.026Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:54.268Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:54.517Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:54.759Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:54.998Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:55.244Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:55.491Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:55.739Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:55.984Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:56.229Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:56.471Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:56.720Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:56.966Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:57.210Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:57.455Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:57.695Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:57.937Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:58.186Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:58.430Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:58.679Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:58.922Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:59.168Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:59.414Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:59.656Z: Sync-reading the content of file at REDACTED
2026-06-07T16:50:59.901Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:00.145Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:00.389Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:00.633Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:00.876Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:01.119Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:01.365Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:01.607Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:01.850Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:02.095Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:02.338Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:02.580Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:02.821Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:03.062Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:03.303Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:03.550Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:03.793Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:04.035Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:04.276Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:04.519Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:04.760Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:05.001Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:05.242Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:05.480Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:05.487Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:05.732Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:05.973Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:06.217Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:06.464Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:06.706Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:06.947Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:07.188Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:07.426Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:07.668Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:07.928Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:08.173Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:08.425Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:08.705Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:08.974Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:09.246Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:09.505Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:09.759Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:10.105Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:10.392Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:10.646Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:10.895Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:11.147Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:11.407Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:11.653Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:11.927Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:12.335Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:12.678Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:12.973Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:13.281Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:13.578Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:13.913Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:14.226Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:14.541Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:14.794Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:15.055Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:15.328Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:15.584Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:15.919Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:16.186Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:16.445Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:16.701Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:16.944Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:17.189Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:17.433Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:17.677Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:17.919Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:18.162Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:18.409Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:18.650Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:18.893Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:19.137Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:19.378Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:19.618Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:19.890Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:20.151Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:20.448Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:20.708Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:20.958Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:21.216Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:21.473Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:21.727Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:21.983Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:22.242Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:22.549Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:22.836Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:23.096Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:23.440Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:23.727Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:23.979Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:24.241Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:24.493Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:24.746Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:25.003Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:25.267Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:25.526Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:25.776Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:26.029Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:26.290Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:26.549Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:26.816Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:27.077Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:27.323Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:27.574Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:27.818Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:28.071Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:28.326Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:28.580Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:28.853Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:29.174Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:29.460Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:29.774Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:30.061Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:30.393Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:30.713Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:31.000Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:31.287Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:31.577Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:31.840Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:32.112Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:32.381Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:32.673Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:32.995Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:33.329Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:33.661Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:34.043Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:34.318Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:34.588Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:34.844Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:35.093Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:35.342Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:35.658Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:35.938Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:36.209Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:36.493Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:36.834Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:37.096Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:37.356Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:37.611Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:37.888Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:38.136Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:38.384Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:38.648Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:38.907Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:39.168Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:39.423Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:39.677Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:40.147Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:40.401Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:40.647Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:40.909Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:41.162Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:41.412Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:41.669Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:41.926Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:42.172Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:42.427Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:42.682Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:42.949Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:43.266Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:43.527Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:43.784Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:44.074Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:44.326Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:44.576Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:44.832Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:45.086Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:45.354Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:45.633Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:45.925Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:46.258Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:46.584Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:46.850Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:47.095Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:47.354Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:47.605Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:47.860Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:48.118Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:48.367Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:48.622Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:48.879Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:49.126Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:49.371Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:49.619Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:49.864Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:50.123Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:50.373Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:50.619Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:50.865Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:51.119Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:51.365Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:51.608Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:51.862Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:52.112Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:52.360Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:52.636Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:52.891Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.137Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.466Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.472Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.478Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.484Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.489Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.494Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.499Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.505Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.509Z: Sync-reading the content of file at REDACTED
2026-06-07T16:51:53.519Z: Sync-reading the content of file at REDACTED

Operating system

Windows 11

CLI version

4.1.0

Shell

Powershell

Nodejs version

v24.14.1

What language and version are you using in your application?

Shopify’s App Remix Template

@muchisx Thanks for the thorough report with the verbose output. We’re looking into potential solutions and will follow up here once we have more to share.

Same here, it’s a bit annoying!

Hi! I’m working in a fix to exclude files from other directories. Could you please try with this snapshot to see if it helps? @shopify/cli@0.0.0-snapshot-20260608100421

I did a quick test this morning and extensions dev preview started for me.

Hi @gonzaloriestra thanks for sending this snapshot!

For me it still seems to indefinitely loop through files that arent even’t in use of the extension (commented out import). And also seems to crawl type imports, which maybe it should skip?

With the help of AI I applied a package patch to the minified code in the meantime, this helps for now.

You can ask prompt AI with:

Add "postinstall": "patch-package" in package.json and a patches/@shopify+cli+4.1.0.patch file temporarily fixing this issue:

Follow this task:

# Task: Patch installed Shopify CLI to stop type-gen from crawling files outside each extension directory

## Why
On every `shopify app build` (and `shopify app dev`), the CLI auto-generates `shopify.d.ts`
for Remote DOM UI extensions (api_version >= 2025-10). It does this by recursively walking the
ENTIRE import graph from each extension entry point and synchronously reading every reachable
first-party file (you see many `Sync-reading the content of file at ...` lines with --verbose).
In our monorepo with lots of shared deps this reads a huge number of files and is very slow.

Key insight: 
- You will be applying the patch to minified code, so find the relevant files. 
- Type definitions are only ever emitted for files whose nearest `tsconfig.json` lives
INSIDE the extension directory (the code uses `findNearestTsConfigDir(filePath, extension.directory)` and skips anything that resolves outside). So reading files OUTSIDE the extension directory is pure wasted work. The fix is to constrain the recursive import walk to the extension's own directory.

This is a temporary local patch until Shopify addresses it upstream.

## Source-of-truth change (from package `@shopify/app`, TypeScript source)
File A: `models/extensions/specifications/type-generation.ts`
File B: `models/extensions/specifications/ui_extension.ts`

### Change A — add a `boundaryDir` parameter to `findAllImportedFiles` and filter resolved paths
`resolvePath` is already imported in this file from `@shopify/cli-kit/node/path` (no new import needed).

Replace `findAllImportedFiles` with:

    export async function findAllImportedFiles(
      filePath: string,
      boundaryDir?: string,
      visited = new Set<string>(),
    ): Promise<string[]> {
      if (visited.has(filePath)) {
        return []
      }

      visited.add(filePath)

      const normalizedBoundary = boundaryDir ? resolvePath(boundaryDir) : undefined
      const resolvedPaths = (await parseAndResolveImports(filePath)).filter(
        (resolved) => !normalizedBoundary || resolvePath(resolved).startsWith(normalizedBoundary),
      )

      const allFiles = [...resolvedPaths]

      for (const resolvedPath of resolvedPaths) {
        // eslint-disable-next-line no-await-in-loop
        const nestedImports = await findAllImportedFiles(resolvedPath, boundaryDir, visited)
        allFiles.push(...nestedImports)
      }

      return uniq(allFiles)
    }

### Change B — pass `extension.directory` at BOTH call sites in `ui_extension.ts`
- `const importedFiles = await findAllImportedFiles(fullPath)`
    → `const importedFiles = await findAllImportedFiles(fullPath, extension.directory)`
- `const shouldRenderImports = await findAllImportedFiles(shouldRenderPath)`
    → `const shouldRenderImports = await findAllImportedFiles(shouldRenderPath, extension.directory)`

Also grep the whole package for any other callers of `findAllImportedFiles` and update them
(they can keep passing no boundary to preserve old behavior, but our two UI-extension call sites
MUST pass `extension.directory`).

## How to apply to the INSTALLED package (this is what actually runs)
1. Detect the package manager from the lockfile (package-lock.json → npm, yarn.lock → yarn, pnpm-lock.yaml → pnpm).
2. Locate the COMPILED file. The runtime code is bundled/transpiled JS, not TS. Search:
       grep -rl "findAllImportedFiles" node_modules/@shopify/app node_modules/@shopify/cli
       grep -rl "parseAndResolveImports" node_modules/@shopify/app node_modules/@shopify/cli
   It is likely under `node_modules/@shopify/app/dist/...`. Identifiers are generally preserved.
   In the compiled bundle, `findAllImportedFiles` and its call sites may live in the same module file.
3. Apply the EQUIVALENT edits to the compiled JS:
   - Add the `boundaryDir` parameter + the `resolvePath`-based boundary filter (use the file's existing
     path/resolve helper; if `resolvePath` isn't in scope in the compiled module, use Node's
     `require('path').resolve` or the bundle's path util).
   - Update the recursive call and the two UI-extension call sites to thread `extension.directory` /
     the boundary argument through.
   - Make the prefix comparison robust: resolve+normalize both sides; on Windows compare case-insensitively
     and ensure the boundary ends with a path separator to avoid sibling-prefix false positives
     (e.g. `/ext` matching `/ext-2`).
4. Persist the patch so it survives `install`:
   - npm/yarn: after editing in node_modules, run `npx patch-package @shopify/app`
     (or `@shopify/cli` if that's where the compiled code lives). Add `"postinstall": "patch-package"`
     to package.json scripts if not present. Commit the generated `patches/*.patch`.
   - pnpm: `pnpm patch @shopify/app` → edit the files in the temp dir as above → `pnpm patch-commit <dir>`.
     Commit the resulting patch entry in package.json / patches.

## Verify
- Run `shopify app build --verbose` and confirm:
  - The `Sync-reading the content of file at ...` lines no longer include files OUTSIDE each
    extension directory (shared monorepo code), and the build is noticeably faster.
  - `shopify.d.ts` is still generated correctly inside each extension and the `shopify` global is typed.
- Optionally test `shopify app dev` the same way.

## Constraints
- Do NOT change behavior for files INSIDE the extension directory (in-extension imports must still be walked).
- Keep the existing `node_modules` exclusion intact.
- Keep the change minimal and reversible; this is a stopgap to be removed once upstream is fixed.

## Fallback (if editing the bundled signature is too fiddly)
As a cruder kill-switch, make `findAllImportedFiles` skip the recursive walk entirely and return only
the entry file (`return uniq([filePath])`). This removes type augmentation for imported helper files
but still types the entry modules, and fully eliminates the deep file reads. Prefer the boundary fix above.



## Notes from another agent that already completed this task

Done — the patch is applied, persisted, and verified. One thing surfaced that you should decide on before any commit: your working-tree package.json already contains an uncommitted @shopify/cli bump 3.94.3 → 4.1.0 (that's your migration change, not mine). It's actually consistent with the patch (the patch file is keyed to 4.1.0), but it means a commit here would also include that bump plus whatever else is in package-lock.json.

What I changed
Patched the live CLI module — node_modules/@shopify/cli/dist/chunk-54CAKCYR.js (the bundled+minified @shopify/app code that app build and app dev actually import; identifiers are minified, so findAllImportedFiles→an, parseAndResolveImports→Ku):
Added a boundaryDir (bD) parameter to an plus a self-contained, Windows-safe normalizer (lowercase + \→/ + trailing-separator) so the prefix check is robust against sibling false-positives (ui-announcementbanner vs ui-announcementbanner-2026):
async function an(e,bD,t=new Set){if(t.has(e))return[];t.add(e);let __nrm=p=>String(p).replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase(),__b=bD?__nrm(bD)+"/":void 0,n=(await Ku(e)).filter(rp=>!__b||__nrm(rp).startsWith(__b)),i=[...n];for(let o of n){let r=await an(o,bD,t);i.push(...r)}return[...new Set(i)]}
Threaded extension.directory through both UI-extension call sites: await an(a,e.directory) and await an(l,e.directory).
Persisted with patch-package (npm) — generated patches/@shopify+cli+4.1.0.patch, added "postinstall": "patch-package" and patch-package to devDependencies. The reinstall confirmed Applying patches... @shopify/cli@4.1.0 ✔, so it survives future installs.
Verification (shopify app build --verbose -c dev)
Build succeeded in ~11s (was hanging); every extension incl. ui-announcementbanner-2026 successfully built.
Sync-reading lines that reference out-of-extension code (shared-2026, extensions/shared, app/db, prisma-enums, admin.types): 0. All 121 reads are inside extensions/ui-announcementbanner-2026/src/….
shopify.d.ts still regenerates correctly with a typed shopify global for all in-extension files (index.tsx, render.tsx, Skeleton.tsx, log.ts).
Notes
I deliberately did not touch index.js's duplicate copy (Ts/CT) — it's the standalone library bundle; the CLI command path (build.js/dev.js) imports chunk-54CAKCYR.js, which is what I patched.
Fully reversible: delete patches/@shopify+cli+4.1.0.patch, remove the postinstall line + patch-package dep, and reinstall.

Hi! Thanks for the feedback.

I’ve prepared another snapshot that uses tsconfig.json files if present and skips type-only imports.: shopify/cli@0.0.0-snapshot-20260610101222

If it doesn’t work, could you please share privately a verbose log?

Hi @gonzaloriestra, Thank you!!

With shopify/cli@0.0.0-snapshot-20260610101222 I still get the issue, I just sent you an email with details

In case anyone else has the same problem, this snapshot seems to work well: @shopify/cli@0.0.0-snapshot-20260611111520

I’m working to include it in the next CLI release.

@muchisx thanks again for your help!