Skip to content

Fix UI extension dev bundle path#7614

Open
devisscher wants to merge 1 commit into
mainfrom
fix-ui-extension-dev-bundle-path-2117
Open

Fix UI extension dev bundle path#7614
devisscher wants to merge 1 commit into
mainfrom
fix-ui-extension-dev-bundle-path-2117

Conversation

@devisscher
Copy link
Copy Markdown

WHY are these changes introduced?

Fixes https://github.com/shop/issues-discounts/issues/2117

shopify app dev regressed for generic ui_extension extensions whose bundle step writes assets under a configured bundle folder. The generated bundle manifest points at the real script path, for example dist/<handle>.js, but draft upload was still reading extension.getOutputPathForDirectory(bundlePath), which resolves to <handle>.js for generic UI extensions.

WHAT is this pull request doing?

  • Updates updateExtensionDraft() to resolve generic ui_extension serialized scripts from the bundle manifest.json main path when available.
  • Keeps the existing output-path fallback when the manifest is missing, malformed, lacks a usable main, or resolves outside the bundle directory.
  • Gates the manifest-aware behavior to generic ui_extension, preserving legacy checkout_ui_extension and web_pixel_extension behavior.
  • Adds focused unit coverage for manifest path usage, missing-manifest fallback, and unchanged checkout UI extension serialization.

How to test your changes?

Targeted test command:

pnpm --filter @shopify/app vitest run src/cli/services/dev/update-extension.test.ts

Local note: I attempted this command, but dependencies are not installed in this checkout (vitest: command not found; node_modules missing), so no tests executed locally.

Manual verification path:

  1. In an app with a generic ui_extension targeting checkout and a generated bundle manifest like { "purchase.checkout.block.render": { "main": "dist/<handle>.js" } }, run shopify app dev.
  2. Confirm draft upload reads <dev-bundle>/<uid>/dist/<handle>.js for serialized_script instead of <dev-bundle>/<uid>/<handle>.js.
  3. Confirm legacy checkout_ui_extension and web_pixel_extension draft uploads still read their normal output paths.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@devisscher devisscher requested review from a team as code owners May 22, 2026 13:25
Copilot AI review requested due to automatic review settings May 22, 2026 13:25
@github-actions github-actions Bot added the Area: @shopify/app @shopify/app package issues label May 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression in shopify app dev draft uploads for generic ui_extension extensions where the bundle output is written under a configured subfolder (e.g. dist/). The change updates how serialized_script is located so it matches the actual bundle output indicated by the generated manifest.json, while preserving legacy behavior for other extension types.

Changes:

  • Resolve ui_extension serialized script path from manifest.json (main) when available and safely within the bundle directory.
  • Keep a fallback to extension.getOutputPathForDirectory(bundlePath) when the manifest is missing/invalid/unsafe.
  • Add unit tests covering manifest usage for generic ui_extension, missing-manifest fallback, and unchanged behavior for checkout_ui_extension.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/app/src/cli/services/dev/update-extension.ts Adds manifest-aware path resolution for ui_extension draft uploads with safety checks and fallback behavior.
packages/app/src/cli/services/dev/update-extension.test.ts Adds focused tests validating manifest-based resolution, fallback, and legacy behavior preservation.
.changeset/fix-ui-extension-dev-bundle-path.md Adds a patch changeset documenting the fix for generic UI extension dev draft uploads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/app @shopify/app package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants