privatenumber / tsx

⚡️ TypeScript Execute | The easiest way to run TypeScript in Node.js
https://tsx.is
MIT License
8.61k stars 132 forks source link

build: disable minification #569

Open isti115 opened 4 weeks ago

isti115 commented 4 weeks ago

There seems to be little need for minification, as this is a node based project never intended to be run in browsers. My reason to get rid of it would be to enable the usage of tools like patch-package on the library, which operate on the distributed source, and is practically incompatible with tsx in its current state.

privatenumber commented 4 weeks ago

Why is minification not benficial in Node?

isti115 commented 4 weeks ago

Thank you for considering my suggestion! While minified code might still have some minimal runtime advantages due to optimization heuristics, (even though the node team seems to be moving away from this approach, e.g. disabling function length based inlining), in my opinion the main benefit to be had is in the reduced bandwidth usage, and thus improved load times when serving web content, which doesn't apply here. Also, even if would be talking about a library that gets used in web pages, I'm of the opinion that minification should be left as a last step to the author of the application itself, not the library. (Or in case of a library that doesn't have to be bundled and can be included from a CDN separately, I think it's the best practice to provide a regular build as well as a minified version ending in .min.js, as many of the widely used libraries do.)

privatenumber commented 3 weeks ago

the main benefit to be had is in the reduced bandwidth usage, and thus improved load times when serving web content, which doesn't apply here

It does. The package needs to be downloaded. And since it gets stored to disk long-term, size probably matters more.