So I have 3 scripts + my html file.
main.ts
which basically enables preload.ts, creates the windows etc. Just the basics.
config.ts
Where I simply just export 1 variable:
export let myValue = "123"
Then preload.ts which replaces an element in the html after it is finished loading with myValue imported from config.ts:
import { myValue } from "./config";
window.addEventListener('DOMContentLoaded', () => {
let h1 = document.getElementById("h1");
if (h1 != null) {
h1.innerHTML = myValue;
}
});
However running this project gives an error saying that it cannot load the config script.
I can easily import and export to the main file, but not to the preload file. How does someone import/export variables in Electron?