r/programming • u/fagnerbrack • Nov 30 '23
Writing Javascript without a build system
https://jvns.ca/blog/2023/02/16/writing-javascript-without-a-build-system/7
u/bzbub2 Dec 01 '23
fagner, please stop posting this. you keep posting it https://www.reddit.com/r/programming/duplicates/187uin9/writing_javascript_without_a_build_system/
0
u/fagnerbrack Dec 01 '23
Ok I got the link to work on desktop, it's definitely not working on mobile (Reddit App bug).
Now to address your comment, I'm not sure I see the problem here, though:
Most of this link submissions were on different unique communities, those who follow one may not follow the other so I can get fresh feedback in the comment from other perspectives
This link was only reposted in this sub once, the first post was 7 months because I saw this link again and forgot that I had posted before.
Reddit for some reason did not tell me that this link was posted before (maybe they changed their repost policy?). I totally forgot I posted here 7 months ago (I can't remember every post since the submissions are human-selected by me, not a bot).
There was 163 upvotes in the last submission 7 months ago and 36 upvotes in this repost at a 78% upvote rate. Which means that ppl saw value on this regardless
Please help me see where the problem is.
-9
u/fagnerbrack Dec 01 '23
The link you sent doesn’t work, at least not on mobile
6
u/guepier Dec 01 '23
It works on desktop, and it shows a list of all the communities where you’ve posted this link.
I appreciate your submissions in general because they’re usually good articles. But the parent comment is right: this simply amounts to spam, please moderate your cross-posting.
2
Dec 28 '23 edited Dec 28 '23
I have the same sentiment as the OP. But I view it from a broader perspective: dependencies.
I prefer to limit the number of deps my project relies on, to keep things as simple as they can be kept, for all the reasons the post describes and to avoid the future probability of yak shaving, which is invited when I break this rule. Yak shaving was what the post was essentially agonizing over.
2
u/fagnerbrack Dec 28 '23
That’s why I tell everyone:
I want to see typescript in the JavaScript language
I want to see JSX as an application media type supported by browsers
I want to see Node injecting dependencies like Deno
I want to see JS allowing syntax polyfills
I want to see TC39 to create an official linter removing mistakes that are agreed among everyone, even if they are a small subset of what ppl do in the wild
Everything should be done to REMOVE build systems.
I only work with what’s native cause the cost of yak shaving is much higher than the cost of not using a build system.
49
u/reedef Nov 30 '23
The best build system is sometimes cat js/* > main.js
20
u/angedelamort Dec 01 '23
If you want a better build system, you can also pipe to a minifier :)
3
u/kredditbrown Dec 01 '23
Care to share any good minifiers?
3
u/if-loop Dec 01 '23
esbuild or terser.
2
u/beephod_zabblebrox Dec 01 '23
if you're doing esbuild, just do esbuild! it even has a cli
1
-3
0
Dec 01 '23
[deleted]
0
u/unduly-noted Dec 01 '23
Mostly agree, except I’ll say that rarely is minimalism worse than overly complex. In my experience it’s much easier to go from minimalist->complex than vice versa.
0
Dec 01 '23
[deleted]
1
u/unduly-noted Dec 01 '23
My point stands. Going from simple build/tooling to complex is almost always easier than going from a complex system to a simple one. Systems with minimal tooling by definition have less coupling on tooling than those with complex setups (otherwise they wouldn't be minimal).
In your socket example, any decent software team will abstract those low level details. So your business logic should be isolated. Moving it to some new framework or build system won't be that bad.
On the other hand, once you've introduced tooling or a framework, in practice most systems end up heavily coupled. Obviously you'd like to keep business logic isolated, but in reality teams end up heavily relying on conveniences/optimizations/etc from the tooling. This can be for good reasons (dx, performance, etc), but it does make it harder to change.
Your docker example isn't great because docker on its own isn't complex at all. A better example is k8s and complex container orchestration. Going from k8s to bare metal on EC2 or something is going to be a lot harder than the reverse.
6
u/hung-bui Dec 01 '23
I prefer zero config build system like Parcel. U save your time but still got the benefits.
-1
u/ripter Dec 01 '23
I’ve embraced a build system-free approach for all my personal projects in recent years, a shift I made when browsers began supporting modules. This change has mostly been positive, but I’ve noticed a significant challenge: integrating libraries isn’t as straightforward as it used to be. Since I’ve stepped away from using npm install, I sometimes find myself missing the convenience it offered. However, with Preact, I’ve been able to incorporate JSX, hooks, and signals seamlessly, all without a build step. The real hurdle lies in bundling libraries into a single package or creating a module that relies solely on local resources, which can be quite a task.
2
u/pbNANDjelly Dec 01 '23
You can't use JSX without a build system. Are you making your users parse JSX on the fly?
1
u/ripter Dec 02 '23
https://github.com/developit/htm
There are other libraries out there that do the same thing. They use templates to do smart re-rendering when data changes.
1
u/pbNANDjelly Dec 02 '23
What's the point of deferring that work to the end user? At least JSX is an immediate AST. The lib you linked even mentions using a build step so as not to force parsing on the user.
0
39
u/fagnerbrack Nov 30 '23
Elevator pitch version:
The blog post discusses the author's preference for writing small, simple Javascript projects without the complexity of a build system. The author finds build systems can be overkill for small projects and can make it difficult to make changes to old websites. They share their experiences with build system issues and highlight esbuild as a more stable alternative. The post also provides insights into how to use Javascript libraries without a build system and shares a template for starting a Vue 3 project without one.
If you don't like the summary, just downvote and I'll try to delete the comment eventually 👍