Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
How can I config Vite build to output with script type="text/javascript"
I'm using Vite 2.7.2, when finished building the code in HTML output the script tag as follow
<script type="module" crossorigin src="/assets/index.0c37d7b4.js"></script>
What I want is
<script type="text/javascript" crossorigin src="/assets/index.0c37d7b4.js"></script>
The code run fine with type="module" but when I manually replace it with type="text/javascript" the code break and output following error
Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')
Here is the original code before building
const elements = { root: document.querySelector('#root'), }; elements.root.innerHTML = `Loading...`;
The reason I want the type to be type="text/javascript" because Shopify platform only accept script with type "text/javascript"