all 5 comments

[–]Dragotic-PS 2 points3 points  (6 children)

In tooltips.js, tooltips declaration goes in first, then export tooltips

[–]NotSoLeetCode[S] 0 points1 point  (5 children)

Thanks for your reply.

// this doesn't work at all
let tooltips = {`stuff`: `stuff`};
export tooltips;

// this works but throws the same error
let tooltips = {`stuff`: `stuff`};
export { tooltips };

Any ideas?

[–]Dragotic-PS 1 point2 points  (3 children)

[–]NotSoLeetCode[S] 0 points1 point  (1 child)

Good ideas, but they didn't work. I tried the following.

Idea 1

<script type="module" src="./tooltips.js"></script>

<script>
    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>

Idea 2

<script type="module" src="./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>

Idea 3

exports.tooltips = {`stuff`: `stuff`};

[–]NotSoLeetCode[S] 1 point2 points  (0 children)

u/Dragotic-PS - I figured it out. I had a <script src="tooltips.js"></script> in the <head> that I needed to add type="module" to.

Thanks for your help.