#2481·systemjs

I need to prevent SystemJS attempting to load dependencies on Shopify site, urls require a version parameter that SystemJS doesn't know

Author: twilson90Created Feb 23, 2024Updated May 2, 2024

I'm trying to set up a project for compiling all the javascript in a shopify theme but I've run into a snag.

I have my main 'app.system.js' script that loads on page load, and additional system.js scripts that load along with any html based components in a svelte-like way.

In my head element:

<script src="{{ 'system.js' | asset_url }}" defer></script>
<script type="systemjs-module" src="{{ 'app.system.js' | asset_url }}" defer></script>

And a component further down in the body looks like this:

<script type="systemjs-module" src="{{ "flipdown.system.js" | asset_url }}" defer></script>
{{ "flipdown.css" | asset_url | stylesheet_tag }}
<div data-component="flipdown" data-date-end="{{ date }}"></div>

But when it tries to load 'flipdown.system.js', it tries to load its dependency 'app.system.js', but it fetches a URL without the necessary v?= parameter, which causes it to load the first version that I uploaded to my store, which causes havoc.

So I get this happening:

chrome_GA2cTFcrk5

Is there any way around this?