Skip to content

fix(web-components): use umbrella Storefront Web Components bundle#385

Closed
paul-phan wants to merge 1 commit into
mainfrom
fix/storefront-web-components-umbrella-bundle
Closed

fix(web-components): use umbrella Storefront Web Components bundle#385
paul-phan wants to merge 1 commit into
mainfrom
fix/storefront-web-components-umbrella-bundle

Conversation

@paul-phan
Copy link
Copy Markdown
Member

What

Switch the Storefront Web Components script tag in app/root.tsx from the per-component bundle to the umbrella bundle:

- src="https://cdn.shopify.com/storefront/web-components/account.js"
+ src="https://cdn.shopify.com/storefront/web-components.js"

Why

The per-component file registers ONLY <shopify-account>. Pilot today renders only that one component, so it works — but any custom section or future Pilot feature that adds a sibling component (<shopify-store>, <shopify-product>, <shopify-context>, <shopify-data>) silently fails: the tag remains undefined and the browser renders nothing in its slot. There's no console error to point at the cause.

This bites anyone trying to:

  • Add a <shopify-product> quick-view from a custom section
  • Use <shopify-store store-domain> as a parent context for multiple sub-components
  • Migrate to Shopify's newer account UI patterns that bundle multiple components

The umbrella bundle registers every Storefront Web Component element from a single HTTP/2 stream. Gzipped size delta is negligible.

Reference

Shopify dev docs — Storefront Web Components uses the umbrella bundle in all examples; the per-component file is an advanced opt-in for size-sensitive contexts.

Risk

Minimal. The umbrella bundle is a strict superset — any storefront that worked with the per-component file continues to work, and additional component tags now resolve where they previously didn't.

Verification

  1. Open any page that renders the header → <shopify-account> still mounts and signs in / shows account icon correctly.
  2. (Optional) Drop <shopify-context country="US" language="EN"></shopify-context> into a section and confirm it now registers (would have remained undefined before this change).

Load the full `web-components.js` umbrella bundle instead of the
per-component `web-components/account.js` file. The umbrella bundle
registers all Storefront Web Components (`<shopify-account>`,
`<shopify-store>`, `<shopify-product>`, `<shopify-context>`,
`<shopify-data>`, …) from a single HTTP/2 stream.

Currently Pilot only renders `<shopify-account>` so the per-component
bundle works, but any custom section or future Pilot feature that
adds a sibling component (e.g. `<shopify-store>` for a custom
account widget, `<shopify-product>` for a quick-view) silently
fails: the tag remains undefined, no error, just a non-functional
placeholder.

The umbrella bundle is the documented Shopify default and has the
same wire cost as a per-component bundle (gzipped diff is
negligible) while future-proofing additional component usage.
@paul-phan
Copy link
Copy Markdown
Member Author

Closing — my premise here was wrong.

I verified by fetching both bundles and checking which custom elements they register:

web-components.js (92KB):
  shopify-add-to-cart, shopify-cart, shopify-catalog, shopify-context,
  shopify-data, shopify-media, shopify-money, shopify-render,
  shopify-variant-selector
  → does NOT include shopify-store or shopify-account

web-components/account.js (31KB):
  shopify-store, shopify-render, shopify-customer-account-data
  → this IS the right bundle for <shopify-account> usage

The two URLs are NOT an umbrella/per-component pair — they're two different bundles for different feature areas (cart/catalog vs. account). Pilot's current web-components/account.js is correct for the <shopify-account> element it uses in the header.

Sorry for the noise on this one. Closing as not-applicable.

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