Fix shopify app build failing for UI extensions with same-path copy#7354
Merged
isaacroldan merged 2 commits intomainfrom Apr 21, 2026
Conversation
The bundle_ui client step always called copyFile to move locally bundled UI extension output into the bundle directory. During a plain `shopify app build` the extension's outputPath was never reassigned to a separate bundle directory, so source and destination collapsed onto the same directory and fs-extra threw 'Source and destination must not be the same.' Skip the copy when both paths share a directory. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes shopify app build failures for UI extensions by avoiding an invalid same-source/same-destination copy during the bundle_ui step.
Changes:
- Add a guard in
executeBundleUIStepto skip copying when the local build output directory matches the extension bundle output directory. - Add unit tests covering both the no-op (same dir) and copy (different dir) branches.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/app/src/cli/services/build/steps/bundle-ui-step.ts | Skips the copy operation when it would copy a directory onto itself, preventing fs-extra from throwing. |
| packages/app/src/cli/services/build/steps/bundle-ui-step.test.ts | Adds tests validating the new conditional copy behavior for both same-dir and different-dir cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
alfonso-noriega
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
Running
pnpm shopify app buildfor an app with a UI extension fails with:The
bundle_uiclient step (added in #7334) unconditionally copies the locally-bundled extension output into the bundle directory. During a plain build the extension'soutputPathis never reassigned to a separate bundle directory (that only happens viabuildForBundle/copyIntoBundlein the deploy flow), so source and destination collapse onto the same directory andfs-extrarejects the copy.WHAT is this pull request doing?
Skip the copy when both
dirname(localOutputPath)anddirname(extension.outputPath)resolve to the same directory.packages/app/src/cli/services/build/steps/bundle-ui-step.ts— guard thecopyFilecall.packages/app/src/cli/services/build/steps/bundle-ui-step.test.ts— new unit test covering both branches (same-directory no-op and different-directory copy)..changeset/fix-bundle-ui-same-path-copy.md— patch changeset against@shopify/app.How to test your changes?
Should succeed and produce
dist/<handle>.jsinside the extension directory.Checklist
patchchangeset added against@shopify/app