That's not how JavaScript works. You have to run it with node.js or in a browser to get it to do stuff. Are you asking how to bundle JavaScript?
this post was submitted on 29 Nov 2023
2 points (75.0% liked)
JavaScript
1911 readers
3 users here now
founded 1 year ago
MODERATORS
Frankly, I know little to none regarding js, but I suppose I'm trying to "bundle" everything into a single binary so it can run in CLI, or in an external window if the former is not possible.
JS is an interpeted language, you can't bundle stuff into a single binary. A "single binary" will require an interpreter to be bundled too, like Electton does
Short answer: don't. Just serve the content using nginx and point a normal web browser at it.
Long answer: Apache Cordova.
You can use Electron or Tauri to make an executable out of a web page.