The import statement seems to create a module. But the way it is implemented seems a little odd. If you have an import at the top, even if it is commented out the global doesn’t work because now it is a module and they have different scoping rules.
This doesn’t work as it makes it a module.
// import something from 'test'
function playSound(key, desc) {
console.log(key);
}
So you have to put the function back on the global object.
// import something from 'test'
function playSound(key, desc) {
console.log(key);
}
window.playSound = playSound;
Edit: just to be clear, for an inline function in the HTML to work it has to be available globally.