Typically you could use something like rollup to compile the lit source into your card source directly.
If you look at many popular custom cards that’s what they do, then that removes the dependency on external webserver. Though it’s more work to setup the pipeline, since you’re not just dealing with a single file anymore but a compiler toolchain.
Here’s an example of a card I did this with. (I’m not an expert so maybe not the best example, but it’s the one I know offhand).
Hi,
Actually I resolved it today by rebuilding the project structure, using toolchain, npm and parcel, to build everything offline, to 1 single file.
No more external dependencies.
Cool. I went with rollup, and also end up with everything in one file. It’s a lot less cumbersome than I expected it to be. Thanks to @karwosts for the starting point!
I’ve since changed to yet another solution - thomasloven’s card-tools - this way I can still tweak my JS files in-place, without needing to “build and deploy”