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.
