Skip to content

address png encoding bug, path changes#7378

Open
JoshuaWhite1 wants to merge 1 commit into04-21-add_assets_config_key_support_for_ui_extension_pointsfrom
04-22-address_png_encoding_bug_path_changes
Open

address png encoding bug, path changes#7378
JoshuaWhite1 wants to merge 1 commit into04-21-add_assets_config_key_support_for_ui_extension_pointsfrom
04-22-address_png_encoding_bug_path_changes

Conversation

@JoshuaWhite1
Copy link
Copy Markdown

@JoshuaWhite1 JoshuaWhite1 commented Apr 22, 2026

Closes https://github.com/shop/issues-admin-extensibility/issues/2452

WHY are these changes introduced?

When serving static assets for UI extensions during development, the dev server only looked in the build output directory and the extension's root source directory. Extensions that declare a per-extension-point assets folder (via the assets config key) had no way to serve those static files through the dev server, leaving assets like images inaccessible at runtime.

WHAT is this pull request doing?

Adds a third candidate lookup path when resolving extension assets: the per-extension-point assets directory declared in the extension configuration. The resolution order is now:

  1. Build output directory (e.g. dist/handle.js)
  2. Extension source root (e.g. tools, instructions)
  3. Per-extension-point static asset folders declared via the assets config key (e.g. ./assets/logo.png)

This mirrors how the admin spec's static_root serves a whole directory of static files.

Additionally, readFile is called with an explicit options argument ({}) so that it returns a Buffer rather than a string, and test assertions are updated to use .toString() accordingly.

A new test covers the fallback to the extension-point assets folder, verifying that a static asset (e.g. logo.png) is correctly resolved and served with the appropriate Content-Type.

How to test your changes?

  1. Create a UI extension with an extension_points entry that includes an assets key pointing to a local directory (e.g. assets: './assets').
  2. Place a static file (e.g. logo.png) in that directory.
  3. Run shopify app dev and request the asset via the extension dev server URL.
  4. Confirm the asset is served correctly with the right Content-Type header.

Alternatively, run the existing test suite:

pnpm test packages/app/src/cli/services/dev/extension/server/middlewares.test.ts

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

Copy link
Copy Markdown
Author

JoshuaWhite1 commented Apr 22, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

@elanalynn elanalynn changed the base branch from 04-21-add_assets_config_key_support_for_ui_extension_points to graphite-base/7378 April 22, 2026 21:34
@JoshuaWhite1 JoshuaWhite1 marked this pull request as ready for review April 23, 2026 15:04
@JoshuaWhite1 JoshuaWhite1 requested a review from a team as a code owner April 23, 2026 15:04
@elanalynn elanalynn force-pushed the 04-22-address_png_encoding_bug_path_changes branch from 3d8f4eb to e70418a Compare April 23, 2026 16:59
@elanalynn elanalynn force-pushed the graphite-base/7378 branch from bf935ec to 8d94171 Compare April 23, 2026 16:59
@elanalynn elanalynn changed the base branch from graphite-base/7378 to 04-21-add_assets_config_key_support_for_ui_extension_points April 23, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant