App reviews, troubleshooting, and recommendations
So I have a button that when pressed opens a modal window. The script resides in the assets folder and it's ReactJS. We get an error that we cannot use import outside a module so we used babel and compiled the file to bypass ES6. When I swapped out the commonJS file, now I get the error that the modal is not defined.
the modalbutton.liquid file contains {{ 'iwtmodalbutton.js' | asset_url | script_tag: 'module' }} which exports the module.
I have seen a few other articles in here around React and Shopify themes not playing nice in the sandbox. Anyone have any thoughts? Will a compiled file work or can we use ReactJS and maybe another plugin.
My sense is the modal window should be a global for the click handler to work.
I used window reference to export the modal and no dice. window.openOfferModal = openOfferModal;
I am sure there is something I am missing here.
This is the error. I have heard there are issues at times with ReactJS in Shopify theme extensions. Any insights would be helpful.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025