#can i use scripts without type='module', but not inline?

12 messages · Page 1 of 1 (latest)

finite sage
#

I DONT WANT TO USE THAT -

fleet spire
#

You can do the following

import scriptSrc from "./some-script.js?url" // Note the ?url
---
<script is:inline src={scriptSrc}></script>
#

This will add the script tag with your unmodified (maybe minified?) script as the src

finite sage
fleet spire
#

Do you want to use regular modules (imported from a url) or imported from npm (just import {something} from "foo")?

finite sage
fleet spire
#

It would probably be better to add a class to your element that hides it, and then remove it in the script to show it once the script loads

finite sage
#

but with type="module" old browsers (even 2017 year) have some issues

fleet spire
#

import x from y is limited to type="module" if you run it in a browser
I may have misunderstood, what is it exactly that you are trying to do and why is your current approach not working

finite sage