I try to split my giant JS file into little parts and import them, but it seems like the import doesnt work and idk why.
My folder structure:
-> index.html
-> js
-> wonderbuild.js
-> start.js
index.html
<body>
<!-- content -->
<script src="js/wonderbuild.js"></script>
<body>
wonderbuild.js
import {start} from './start.js';
window.onload = function() {
start();
}
start.js
export function start() {
document.getElementById("loading-circle").style.opacity = "0";
document.getElementById("welcome-message").style.opacity = "1";
setTimeout(() => {
document.getElementById("loading-screen").style.opacity = "0";
setTimeout(() => {
document.getElementById("body").style.overflowY = "visible";
document.getElementById("loading-screen").style.display = "none";
}, 500);
}, 4000);
}
When im not import this function, all works fine. Anybody have an idea to fix this?