Skip to main content

about 3 years ago Syntax Podcast

JavaScript.exe - Standalone Executables

Wes Bos

Wes Bos Host

Scott Tolinski

Scott Tolinski Host

Topic 0 13:46

Dino and Bun executables

Wes Bos

in the next year or 2. Word.

Wes Bos

implement a bunch of flags

Wes Bos

And then Jared from BUN to I'm curious how large that is. They say it can run super fast, but I'm curious, like, maybe we will be able to compile Eighty 6. Hello. Eighty 6 meg. Hello, world. Yeah. And the answer to that is, yes. It's 86 megs because it's 85.999 So, you know, we talk about Intl all the time. You can format money in any currency for any type of viewer. You can format dates for around the world. You can give it a list of But I also I talked to the folks from Fastly. I wanna get them on the show.

Scott Tolinski

Head on over to syntax.fm just the your

Wes Bos

You're this X, Y, and Z on you're gonna be limited by memory and CPU before you are actual size. Right. Micro SD cards cost nothing. Exactly. Yeah.

Scott Tolinski

It's syntax dot f m on, blue sky. Mhmm. Cool. Well, that's it, and we will catch you on Wednesday. Alright. Peace.

Wes Bos

So on Mac, you don't need that because it's it's built in to to the Mac. However, it's bundling the entire INTL package, which was I tweeted out about this, the engine in Firefox, JavaScript engine, and they've made that their runtime. But JavaScript Executables.

Scott Tolinski

or drop a review if you like this show.

Scott Tolinski

And don't forget to subscribe in your podcast player Megabyte.

Scott Tolinski

for a full archive of all of our shows,

Wes Bos

and say, just give me the North American Intl API. And it it dropped, like, 25 megs off of it. So if you're not formatting environment similar to like a Cloudflare Worker, right? to bring applications the actual application that yours is built in.

Wes Bos

then maybe you can do a custom build of this type of thing if you really do care about how big of a size this will be. It feels like if you really care about the size, you should just be writing it, not in JavaScript. Yeah, that's true as well.

Wes Bos

I'm trying to think of, like, a executable Assembly. They are sorry. They compiled it to Wasm, JavaScript is not a

Wes Bos

It's not that big of a like maybe if you were running it in, like, a like 20, 25 megs alone currency for executable was to run this That's it. JavaScript Executables.

Topic 1 05:44

Reaching Node from other languages

Scott Tolinski

I use an SD card plugged into a u s a USB

Scott Tolinski

to a a school computer. Mean, I remember doing that too. Even in college, you'd go to the computer lab, and it's it's actually kind of a weird moment to think that USB sticks

Wes Bos

comes back, and then you get the text in PHP and output it in your PHP rendering, right? So that's you being able to reach for other things Egyptians, Other use cases

Scott Tolinski

translator. More than anything nowadays, if I need to install an OTA on my car. I have the best little,

Wes Bos

USB

Scott Tolinski

storage on SD cards than anything else.

Wes Bos

So over the years, she's collected lots of 16 gig cards that, like, it's too small to put in a camera anymore. So she gives them to me.

Scott Tolinski

I've probably

Scott Tolinski

long past their peak usage at this point, you know, even though, like, storage on them is probably outrageous now, but I ain't got no need for that. I got the cloud. Yeah. Yeah, exactly.

Wes Bos

in other languages from So

Wes Bos

People

Wes Bos

I just have millions of SD cards around. Like, my sister is a photographer,

Scott Tolinski

You know what I use now is I just because I have I have much more

Wes Bos

I've had a print stuff. I sometimes still bring a USB in, although emailing it is generally easier.

Scott Tolinski

development environment on a USB stick. Just the amount of, like, wrong in that statement that you could just plug in a USB

Wes Bos

SD reader. It takes mini SD, regular size SD, and it has USB c on one side and USB a on the other side. It's the best because, like, instead of buying a USB stick,

Topic 2 01:10

What JavaScript executables are

Wes Bos

the idea with JavaScript Let us know

Wes Bos

compiled or or bundled language, meaning that when you Oh.

Scott Tolinski

Like yeah. No. No. It's it's not by default. Yeah. Some languages out there

Wes Bos

And wherever you're running that, it has to run an environment that has JavaScript. It has to have the entire runtime available to you. So Node recently announced something that they have, Which is being able to stuff in this area on the school computers, anywhere. Not anywhere, but you can run-in places that you have without having to have Node and NPM and all the correct versions and all of these things installed, I Rather than you having to go ahead and say, okay. Well, in order to run this, to bundle without a lot of the stuff so they could they will be working on making it much smaller.

Wes Bos

So let's get into a compiled like Go Only running in PHP, and you can't install Node. Well, the answer to this is you bundle your entire app into a single executable, is that milk, eggs, cheese. And you can for North America, we will say milk, eggs and cheese, and and you'll get the commas and the and or the opera. And it'll do that around the world. That package that does internationalization

Wes Bos

You can run it and it will compile it to

Wes Bos

as well as the entire Node. Js runtime JavaScript is not that way. You write JavaScript, and then you have to ship that and run that.

Wes Bos

is an example.

Wes Bos

that you can then move around exciting for JavaScript. Not that most people will need this. However, I I also I went and It does that sort of as a child process, I did the same app, and it was pretty much bang on size with this type of thing.

Topic 3 02:48

Use cases for JavaScript executables

Wes Bos

there are a handful of use cases that you I don't I don't know which one I would like, but I I do know as as, like, a similar if you take a look at other things out there, actual JavaScript runtime because at least for now, your computer's CPU.

Wes Bos

and the logic for that application runs in Node. Js. So rather than you saying Again, it has to run locally for whatever reason. Right? You can't. It maybe the files are too large or for whatever reason.

Wes Bos

onto a user's computer. So he works in IT department.

Wes Bos

or bun or Dino or whatever. If you wanna take that and run that somewhere else, the 86 meg JavaScript run. Quite quite honestly, it's amazing that can have an entire is massive, and it's it's part of

Wes Bos

the people that Need to run it, and they can run it on their computer without having to tell them, okay. We'll go go to IT first, you have to download this folder full of JavaScript files or like a bundled single JS, will allow you to you write like like Rust

Wes Bos

and then you could just send that executable to JavaScript jokes and, like, the stuff people reply to it because,

Wes Bos

and allow them to npm install People like, why don't you just tree shake it? I'm pretty sure you can't tree shake C plus plus that runs on Node. Js JavaScript does not compile into assembly code, most operating systems.

Wes Bos

So What he did is he just bundled it into a single executable,

Wes Bos

application unfortunately, hello, world. And then I showed environment, to servers that are not node servers. So if you think about packages it up into a tiny, not a tiny a single it's not tiny. We'll talk about that into a single You can run Node programming environment run-in

Wes Bos

That need this specific application

Scott Tolinski

Extremely not portable.

Wes Bos

and then you have to go make sure you go get NPM and make sure you go get the correct version of Node. Js installed. And hopefully you don't have any issues with your employer allowing Go is like this, it will compile it to low level assembly code that will just run on it's nice to have it entirely self contained in a single executable it is a hosting provider. But one of the things they have is So Dino has this as well. It's called Dino Compile.

Wes Bos

your thing. It's just

Wes Bos

Extremely not portable. Yeah. Exactly.

Wes Bos

might need something like this. Probably the biggest one is is portability.

Wes Bos

X, Y, and Z. It's not going to work. In a lot of cases, it's not going to work.

Topic 4 08:26

Criticisms and defense of executable size

Wes Bos

got so angry. It's probably the most I've ever been, JavaScript to assembly and then they also compile your code to Wasm.

Wes Bos

that's I understand that if people are thinking about, like, it's exhausting that every single Elektron app has its own version of Node, All that big. Like, in the same breath, people the next day, I was asking about Python, and people were telling me

Wes Bos

to install this, like, Python special package manager.

Wes Bos

So I don't there are ways to to get it smaller. Talk about that in just a second. But the reason why it is so huge, which is 86 megs, A good example is the Tailwind compiler, right? SpiderMonkey, which is and I showed Like, I know. Like, people are going to ask how big this is. So I put the show the size in it. It was 86 megs, the Mac OS version of it is only 25 megabytes, so it is getting quite a bit smaller. And I bet we'll see a lot of

Scott Tolinski

that small. Right? It is. And and it's that it is frustrating specifically it. Because people just will ignore the context of every Yeah. Just just as an opportunity to get out of something. Yeah. Just to get a just to get a funny tweet. But in in reality, you know,

Wes Bos

86 megs is If you want to be able to bring an entire What you would use these types of things for. If you have used them, we'd love to hear it. Tweet us at syntax f dot f m. No. At syntax f m.

Wes Bos

like, harassed on the Internet. Not because, like, people don't like JavaScript, but I turned into the, and people lost their minds.

Wes Bos

and theoretically, you could ship every node module with its own version of node. But that's not what this is four. This is for what we just talked about earlier. There's these situations where you need a standalone executable. And quite honestly, I don't think that just for the INTL. So if you can So this is kind of and you cannot tree shake.

Wes Bos

And it was 3 and a half gigs. And I was like, you're the same people that were just getting mad at Sixteen gigs is is plenty. Right? Yeah. I have 1 big 64 one that I just use for everything for my camera. Just try to put note on it. It'll fit. So let's talk about the actual I will it. So,

Wes Bos

like, the punching bag for everybody's And the last 1 is just like you could you could run it on a USB stick. I remember I don't know how much popular how popular this is these days, but when I had a computer class in high school,

Wes Bos

Matt from Caddy tweeted it out, and he's big in the Go community. Right? And, like, they have, like, their own Edge spot where you would run. You care about the size of that, but not about the CPU. You know, like, if it's running on, like, an Arduino or something, what that is real quick, and then we'll get into, like, why would you ever want to do that? So which honestly,

Scott Tolinski

people who

Topic 5 00:00

Transcript

Announcer

Monday. Monday. Monday.

Scott Tolinski

key.

Announcer

soft skill, web development, the hastiest, the craziest, the tastiest TS Webb development treats coming in hot. Here is Wes, Barracuda,

Scott Tolinski

Welcome

Announcer

Open wide dev fans, get ready to stuff your face with JavaScript, CSS, node modules, barbecue tips, get workflows, breakdancing,

Topic 6 10:22

Executable size comparisons to other languages

Scott Tolinski

I I I saw some release about the news windows, and all of the Reddit comments were, like, never installing this. And it's just like, you don't think there's anything in here for updates. You don't think there's anything in here, like, for me? Like, give me all the updates all the time. I I don't care. Just yeah. I'm sorry. Unrelated rant. But, like, 80 megs. Nothing. I know it's a Hello World. That's not the point. Yeah. Totally. I would be mad if I had 80 of these installed in my system, But again, we talked about the benefits and the why of that. That was missed by LOL. Hello, World is whatever. And node modules is so big, which is also why we just did that show on why is Node modules so big. The answer to that is all of that Node modules will not be part of your end application

Scott Tolinski

Megabit

Scott Tolinski

sized JavaScript executable or 81 megabit.

Wes Bos

because You can bundle your application. You don't need all that stuff to be included in the bundle. Would you rather have 180

Wes Bos

app is I asked a couple of people, they're like, Ah, generally, like 2 to 15 megs is like a general Go application. So obviously quite a bit smaller, And that is because those things are compiled to assembly.

Scott Tolinski

8 80 megs is like nothing these days anyways. I'm sorry, folks. We have computers with giant terabytes. Some people just, like, live living like a 1000000000 years ago. You know, it's like it's it's not the same thing, but it's a frustratingly similar type of person to the type of person who, like, won't

Scott Tolinski

install a modern version of Windows because LOL, they all suck. When it's like, bro,

Scott Tolinski

So you're gonna get you're gonna get trouble mixing those up. Yeah. I know. Sorry.

Topic 7 12:20

Potential for smaller JavaScript executables

Wes Bos

They compiled it to, We used to bring all kinds of stuff on USB sticks because you couldn't download or run stick your entire Boss, and Scott and bring with you and run-in or like rust based stuff That is in Indino.

Wes Bos

So I guess it is possible I don't know how many times. I used it to hack a Wii a couple of months ago, and then I like, I went to anything which is really nice.

Scott Tolinski

Yeah. Yeah. That would be a thing. Yeah.

Scott Tolinski

Have you heard of Fastly before? You know, I see it's one of those companies that I've seen their logo so many times. I've seen their website. I've been to their website.

Wes Bos

code at some point. Right? It's a thing. Pretty neat.

Scott Tolinski

I personally don't have a ton of use for it, but they were one of those logos that pops up everywhere. So I've never really cataloged it in my brain because it always just seemed like somebody else's thing. Honestly, I just thought I've seen their logo all the time, and I'm like, oh, that's, like, some hosting provider from the fastest 5 post or something. Yeah. Yeah. But it's not. It's, well, oh, man.

Topic 8 04:40

Running JavaScript on non-JS servers

Wes Bos

is that node Now can run it into executable. I showed an example of,

Wes Bos

and you can run this from literally any programming language that allows you to run a shell process.

Wes Bos

that

Wes Bos

what do you do? You install PHP and Node on your server and you have to maintain both of those things. What if you're using some sort of service They have a lot of people in accounting

Wes Bos

and part of the PHP If you want to be able to run this in a PHP A large majority of those tools are built in JavaScript, right? put stuff on USB sticks and launch it. No problem. So if you really wanted to, you could where I visited a website in PHP,

Wes Bos

all of the tools surrounding our ecosystem, deploy tooling So I I heard I posted this on Twitter, and there's a couple of people who said, I use this a lot tweeted out just like yesterday that he is working on it as well. And

Wes Bos

So all programming I did an example with PHP And what they've done is they've taken create a stand alone executable of your node application. And, essentially, what it does is it takes your entire application, all the dependencies that are necessary, compiled this without INTL.

Wes Bos

or Rails the output, But you could They have said that they are going to node script.

Topic 9 00:28

JavaScript executables discussion

Scott Tolinski

executables.

Scott Tolinski

not always EXE. That's the that's the Windows extension. So let's talk about what the heck in a JavaScript executable is

Scott Tolinski

and why we might need to worry about them and what people are doing about them in the space. We have a bunch of new players, whether that's no Dino bun. A lot of people talking about executable these days. With me as always is my man, Wes Bos. Wes, what's up, my dude? Hey, I am stoked to talk about

Scott Tolinski

We're gonna be executing on some executables talking about dot exe.

Scott Tolinski

to Syntax.

Scott Tolinski

Although, executable's

Scott Tolinski

On this Monday, hasty treat. We're gonna be talking about

Scott Tolinski

JavaScript

Share

Empowering developers for over 286196171710 milliseconds!