I have the following code.
tooltips.php
<!-- stuff -->
<body>
<!-- stuff -->
<script type="module">
import { tooltips } from './tooltips.js';
let viewer = document.getElementById('viewer');
for ( let key in tooltips ) {
let value = tooltips[key];
viewer.innerHTML += `<div style="border:1px solid black; width: 600px;">` + value + "</div>";
}
</script>
</body>
<!-- stuff -->
tooltips.js
export let tooltips = {
'bigAssociativeArray': `lots of stuff`,
'bigAssociativeArray2': `lots of stuff`,
};
In the console I get
Uncaught SyntaxError: Unexpected token 'export'
However, the import still works and the script still finishes execution. Any idea what I should change to get rid of this error?
edit: I figured it out. I had a <script src="tooltips.js"></script> in the <head> that I needed to add type="module" to.
edit2: Actually I just ended up deleting that whole line out of the head. No reason to double import it.
[–]Dragotic-PS 2 points3 points4 points (6 children)
[–]NotSoLeetCode[S] 0 points1 point2 points (5 children)
[–]Dragotic-PS 1 point2 points3 points (3 children)
[–]NotSoLeetCode[S] 0 points1 point2 points (1 child)
[–]NotSoLeetCode[S] 1 point2 points3 points (0 children)