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
 

Title. I'm trying to compile this but I can't seem to do so with node.js.

Thanks in advance.

top 5 comments
sorted by: hot top controversial new old
[–] blackstampede@sh.itjust.works 3 points 9 months ago (1 children)

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?

[–] GustavoM@lemmy.world 1 points 9 months ago* (last edited 9 months ago) (1 children)

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.

[–] moreeni@lemm.ee 1 points 9 months ago* (last edited 9 months ago)

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

[–] shnizmuffin@lemmy.inbutts.lol 2 points 9 months ago

Short answer: don't. Just serve the content using nginx and point a normal web browser at it.

Long answer: Apache Cordova.

[–] Macil@programming.dev 2 points 9 months ago

You can use Electron or Tauri to make an executable out of a web page.