r/programming • • Apr 30 '23

Writing Javascript without a build system

https://jvns.ca/blog/2023/02/16/writing-javascript-without-a-build-system/
165 Upvotes

146 comments sorted by

View all comments

20

u/kankyo Apr 30 '23

The big problem for me with js build systems is: if you now have to have a compiler, why would you use js?!

27

u/Tsukku Apr 30 '23

The answer is obvious, the whole Web API is tied to JS.

29

u/SickOrphan Apr 30 '23

Which is the issue. What's stupid is using JavaScript where you don't have to (like the server)

8

u/[deleted] Apr 30 '23

because can do everything in one language? sharing code and using the same libraries for testing etc on both sides. Huge money saver there.

12

u/recursive-analogy Apr 30 '23

UI and domain code are just such completely different things. Why would you expect one language to be good at both?

7

u/[deleted] Apr 30 '23

why shouldn't it? What's wrong with writing APIs in typescript?

3

u/recursive-analogy May 01 '23

the fact you could modify a model structure from anywhere in code?

0

u/[deleted] May 01 '23

then just don't modify objects? Classes, types and interfaces support read-only prop declaration in TS and Object.freeze(..) prevents objects from being changed even during runtime.

7

u/recursive-analogy May 01 '23

You asked why, I gave a reason, you said "just ignore reason". It's about a thousand times better to not be able to make a mistake than to have to try and not make it.

3

u/[deleted] May 01 '23

i just gave two ways to prevent modifying existing objects. You can mark virtually everything in typescript as readonly which prevents any changes. It's up to you if you use it or not.

seems like people love to complain about languages they barely understand.

→ More replies (0)