Is there a way to import external JavaScript files into my HTML file without causing any issues? Similar to how @import
works in CSS.
I've seen suggestions like appending a script tag to the DOM on websites like StackOverflow, but this method loads the files asynchronously. This becomes problematic when the order of the files is crucial - for example, if the second file relies on the first one. Loading jQuery before its dependencies might result in errors because jQuery hasn't finished loading yet.
Considering this, asynchronous loading doesn't seem suitable. Is there a method to synchronously load JavaScript files from another JavaScript file?