Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Shopify CLI for functions development not respecting extension.build toml config #5458

Open
2 tasks done
subeshpokhrel opened this issue Feb 25, 2025 · 3 comments
Open
2 tasks done
Labels
Type: Bug Something isn't working

Comments

@subeshpokhrel
Copy link

subeshpokhrel commented Feb 25, 2025

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Function, Extension

Expected behavior

This documentation describes [extension.build] to specify external directory to watch for changes, but it looks like CLI is not respecting that config.

https://shopify.dev/docs/apps/build/app-extensions/configure-app-extensions#shopify-functions-extensions

Folder structure below.

├── @bc-common
│   ├── bc-common-components
│   │   ├── package.json
│   │   └── src
│   ├── bc-common-scripts
│   ├── bc-types
│   │   └── src
│   ├── tsconfig.json
│   └── vite.config.js
├── README.md
├── SECURITY.md
├── dist
├── extensions
│   ├── discount-off-rrp
│   │   ├── dist
│   │   ├── generated
│   │   ├── locales
│   │   ├── package.json
│   │   ├── schema.graphql
│   │   ├── shopify.extension.toml
│   │   ├── src
│   │   └── vite.config.js
│   ├── discount-off-rrp-js-block
│   │   ├── README.md
│   │   ├── dist
│   │   ├── locales
│   │   ├── package.json
│   │   ├── shopify.extension.toml
│   │   ├── src
│   │   ├── tsconfig.json
│   │   └── vite.config.js
│   ├── product-discount-js
│   │   ├── dist
│   │   ├── generated
│   │   ├── locales
│   │   ├── package.json
│   │   ├── schema.graphql
│   │   ├── shopify.extension.toml
│   │   ├── src
│   │   └── vite.config.js
│   └── product-discount-js-block
│   ├── README.md
│   ├── dist
│   ├── locales
│   ├── package.json
│   ├── shopify.extension.toml
│   └── src
├── index.ts
├── package-lock.json
├── package.json
├── shopify.app.toml
└── yarn.lock

Actual behavior

Changes to the @bc-common folder does not trigger a re-build of function UI.

Verbose output

Verbose output
Folder structure below.

├── @bc-common
│   ├── bc-common-components
│   │   ├── package.json
│   │   └── src
│   ├── bc-common-scripts
│   ├── bc-types
│   │   └── src
│   ├── tsconfig.json
│   └── vite.config.js
├── README.md
├── SECURITY.md
├── dist
├── extensions
│   ├── discount-off-rrp
│   │   ├── dist
│   │   ├── generated
│   │   ├── locales
│   │   ├── package.json
│   │   ├── schema.graphql
│   │   ├── shopify.extension.toml
│   │   ├── src
│   │   └── vite.config.js
│   ├── discount-off-rrp-js-block
│   │   ├── README.md
│   │   ├── dist
│   │   ├── locales
│   │   ├── package.json
│   │   ├── shopify.extension.toml
│   │   ├── src
│   │   ├── tsconfig.json
│   │   └── vite.config.js
│   ├── product-discount-js
│   │   ├── dist
│   │   ├── generated
│   │   ├── locales
│   │   ├── package.json
│   │   ├── schema.graphql
│   │   ├── shopify.extension.toml
│   │   ├── src
│   │   └── vite.config.js
│   └── product-discount-js-block
│       ├── README.md
│       ├── dist
│       ├── locales
│       ├── package.json
│       ├── shopify.extension.toml
│       └── src
├── index.ts
├── package-lock.json
├── package.json
├── shopify.app.toml
└── yarn.lock

Reproduction steps

  1. Add this to toml
watch = ['../../@bc-common/**/*', 'src/**/*']
  1. make changes to @bc-common directory
  2. Should expect CLI to watch for changes on that directory and rebuild a draft.

Operating System

Mac OS Sonoma

Shopify CLI version (shopify --version)

@shopify/cli/3.75.0 darwin-x64 node-v20.11.0

Shell

No response

Node version (run node -v if you're not sure)

No response

What language and version are you using in your application?

No response

@subeshpokhrel subeshpokhrel added the Type: Bug Something isn't working label Feb 25, 2025
@gordonhirsch
Copy link
Contributor

Hi @subeshpokhrel. Unfortunately, this particular use case is a bit beyond the current capabilities of the file watcher. It attempts to determine the affected extension from the file path, and, since @bc-common is not recognized as an extension path/sub-path, the file events from that directory are not processed.

We could consider something more sophisticated where a map of extension paths to watch paths is maintained,
but this would add a fair amount of complexity, and I'm not sure we could assign the work a high priority.

For source shared across multiple extensions, the only workaround I can think of would be to use symbolic links, but that would introduce other problems.

@subeshpokhrel
Copy link
Author

Thanks @gordonhirsch for you response. Yes, I have resorted to using symlink for now, however I am unaware of any problem that can come. If you can share any insights that would be great, otherwise, I will know when I know, I guess! :)

@gordonhirsch
Copy link
Contributor

My statement might have been a bit too strong above. It may not be an issue for you, but I recall problems in the past with the combination git, symbolic links, and Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants