#Using an imported JS module

2 messages · Page 1 of 1 (latest)

unreal totem
#

I'm trying do import a script and use it on the client:

in index.astro:

import code from '@some/code'
---
<script is:inline>code()</script>

Is this possible?

gleaming kernel
#

You can import client side code inside a <script> tag (or UI framework like React/Vue/Svelte): ```html
<script>
import code from '@some/code'

// do some logic with 'code'
</script>