Questions and discussions about using the Shopify CLI and Shopify-built libraries.
I am building an embedded Shopify app with Rails / Webpacker and shopify_app gem, which uses React on the front end. I am able to render components and enjoy all the React goodies except for one -- hot module reloading (HMR).
I know that Node / Next.js / Koa apps are able to utilize HMR and I am trying to figure out how to do this with my poor old Rails app.
I noticed that HMR polling pings are getting denied with:
ShopifyApp client received [object Object] from unknown origin [my_ngrok_instance]. Expected https://[my_store_name].myshopify.com.
Seemingly, there is no way to pass multiple origins in ShopfyApp initializer, but maybe there is a way to let Shopify know that my local dev domain is allowed.
Here is an SO question from someone who is having the same exact issue: https://stackoverflow.com/q/56573231/3284936
Hey @dimanyc ,
Resolved the hot reloading not working by changing client/index.js
from
if (module.hot) {
module.hot.accept('./index.js');
module.hot.accept('./', renderApp);
}
to
if (module.hot) {
module.hot.accept();
}
"""
To learn more visit the Shopify Help Center or the Community Blog.