Files called within js file will not change url

I’m not 100% sure this is a MODx issue, but I recently made a clone of a site, cpanel account and all, and I changed the clone’s URL. The rest of the URL changed except for the js files called inside a parent js file they still reflect the old URL and are giving CORS errors. I have tried multiple browsers and get the same errors, I have cleared the modx cache inside the CMS and manually from CPanel, but nothing has worked.

Any help would be appreciated.

MODx version 2.8.6
Apache version 2.4.57
And Im on Chrome

How exactly are these files called?

with the import keyword

To give more information about the Javascript files the main file is put into the page with a script tag with type=“module”, which allows me to import other js files.

So you have a script tag like this in a MODX resource:

<base href="[[!++site_url]]">
<script type="module" src="assets/js/some_file.js"></script>

And then in the file “some_file.js” a line like this:

import { someValue } from "./some_module.js";

And you are saying that when you request the page, “some_file.js” loads correctly but the request to “some_module.js” has the wrong domain? Or the wrong path?

And you don’t use any bundlers for your JS files.

Yes, that is the setup. It has the wrong domain, and no I don’t use bundlers.

If the JS file are referencing the old URL it sounds like they’re hard-coded and need to be manually changed.

they are not hard coded

Figured it out it was not a MODx issue. Thank you all for the help.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.