Hi there, I’m trying to use module scripts in my theme block extension but I’m running into an issue/bug seemingly from Shopify’s side.
I have several JS files in my assets
folder and I import my main JS file like so:
<script src="{{ 'app.js' | asset_url }}" defer type="module"></script>
Then in the JS file I import the other files like so:
import { listItemTemplate, markerTemplate } from './templates.js'
import { debounce, updateEntitiesWithDistance } from './utils.js'
This would usually work, but I guess Shopify modifies the files somehow and the files that are not directly imported in the .liquid
file aren’t updated to have the latest changes.
I noticed this in the Chrome Devtools in the Sources tab:
The file contents are old and don’t have the v
parameter.
Are module scripts viable on Shopify at the moment? Is there a workaround?