Hello.
I got the impression from reading the docs that you can use any npm library within script tags by just importing it, and that it will be bundled with the page that requires it.
I did it, and works perfectly in development, but once deployed to vercel, the code is not executed (is basically confetti). Any way I can debug this ? Really wish is not another problem with the Vercel adapter
#library used in script tag not being transpiled
1 messages · Page 1 of 1 (latest)
Ok, for some reason the code is NOT being transpiled:
]Uncaught SyntaxError: Cannot use import statement outside a module (at confirm-yes:7:3)
library used in script tag not being transpiled
Hi, does the script tag have attributes like is:inline? If so, you might have to add type="module" to it.
https://docs.astro.build/en/guides/troubleshooting/#cannot-use-import-statement-outside-a-module
The problem was similar, indeed
I thought that, in order to use typescript I had to add lang="ts"
Removing all attributes fixed the problem
Thanks
No problem!