I’m trying to import interact.js with an importmap, but I get the error:
Uncaught SyntaxError: Unexpected identifier 'interactjs'.
My importmap:
<script type="importmap">
{
"imports": {
"interactjs": "https://cdn.interactjs.io/v1.9.20/interactjs/index.js"
}
}
</script>
My JavaScript code:
<script type="module">
import interact from interactjs;
interact('.item').draggable({
onmove(event) {
console.log(event.pageX, event.pageY)
},
})
</script>
A normal script src include works without issue.
<script src="https://cdn.jsdelivr.net/npm/interactjs/dist/interact.min.js"></script>
Any ideas?