Skip to content

Fix shopify app build failing for UI extensions with same-path copy#7354

Merged
isaacroldan merged 2 commits intomainfrom
04-21-fix_shopify_app_build_failing_for_ui_extensions_with_same-path_copy
Apr 21, 2026
Merged

Fix shopify app build failing for UI extensions with same-path copy#7354
isaacroldan merged 2 commits intomainfrom
04-21-fix_shopify_app_build_failing_for_ui_extensions_with_same-path_copy

Conversation

@isaacroldan
Copy link
Copy Markdown
Contributor

@isaacroldan isaacroldan commented Apr 21, 2026

WHY are these changes introduced?

Running pnpm shopify app build for an app with a UI extension fails with:

Build step "Bundle UI Extension" failed: Source and destination must not be the same.
  at (.pnpm/fs-extra@11.1.0/node_modules/fs-extra/lib/util/stat.js:49)

The bundle_ui client step (added in #7334) unconditionally copies the locally-bundled extension output into the bundle directory. During a plain build the extension's outputPath is never reassigned to a separate bundle directory (that only happens via buildForBundle/copyIntoBundle in the deploy flow), so source and destination collapse onto the same directory and fs-extra rejects the copy.

WHAT is this pull request doing?

Skip the copy when both dirname(localOutputPath) and dirname(extension.outputPath) resolve to the same directory.

  • packages/app/src/cli/services/build/steps/bundle-ui-step.ts — guard the copyFile call.
  • 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?

pnpm shopify app build --path /path/to/app-with-ui-extension

Should succeed and produce dist/<handle>.js inside the extension directory.

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 — patch changeset added against @shopify/app

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>
Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the devtools-gardener Post the issue or PR to Slack for the gardener label Apr 21, 2026
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@isaacroldan isaacroldan marked this pull request as ready for review April 21, 2026 11:15
@isaacroldan isaacroldan requested a review from a team as a code owner April 21, 2026 11:15
Copilot AI review requested due to automatic review settings April 21, 2026 11:15
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 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 executeBundleUIStep to 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.

@isaacroldan isaacroldan added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit e11905e Apr 21, 2026
46 of 50 checks passed
@isaacroldan isaacroldan deleted the 04-21-fix_shopify_app_build_failing_for_ui_extensions_with_same-path_copy branch April 21, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devtools-gardener Post the issue or PR to Slack for the gardener

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants