Alright, I have looked on this site and have found several different answers, none of which have worked for me. Basically had a js file that had many functions in it along
On the script tag you are using to load the js in the browser you need to add the attribute
type="module"
It will look like the following:
utils.mjs:
export function addTextToBody(text) {
const div = document.createElement('div');
div.textContent = text;
document.body.appendChild(div);
}
This is if you are not using a bundler like webpack and working directly in the browser.
Source of code: https://jakearchibald.com/2017/es-modules-in-browsers/