28 points · by todsacerdoti · 5y ago · 43 comments
I've never understood why this is deemed such a big ask by so many people. You can either compile JS-to-JS or have your JS break when it encounters an old browser (which is exceedingly rare, these days, so you don't really need to compile JS-to-JS. Most of the "bullshit" [aka tooling] these days bundles and optimizes your JS).
Many languages have compilers that you need to run. Before running a Java program, you need to compile it. And compiling things with `javac` is hardly simple. You need to populate your classpath, configure all kinds of stuff. It's not trivial. So why is it such a big deal when you need to do the same thing when making a webapp?
To make meaningful, portable applications in JS, you need to use a compiler. That's both due to the varying runtimes your code will encounter, and due to the fact that your application consists of many files that benefit from being compiled together by tooling versus by you, by hand. Configuring such a compiler (webpack, parcel, rollup, etc) can be of varying levels of complexity. Next.js makes starting a webapp trivial. It's what create-react-app should be.
Yeah, if you want to just make an HTML, that's fine, you can just roll some JS and it'll probably work in most browsers. But if you're making an application, then it makes sense to start using some tooling. When has this not been the case in web development? Even before client-side apps really took off, getting your server-driven HTML-emitting application going was hardly simple.
It's the “Script” bit of “JavaScript”. Once your scripting language needs compiling, it's jumped the shark. You need to go back to the drawing board and invent something else. “I don't want to compile JavaScript” is the face of it, yes, but at its core, this sentiment rails against the entire bloated, over-developed, under-engineered state of contemporary JavaScript.
1/ no compilation step during development, but it breaks old browsers;
2/ continuous compilation while developing so that you support old browsers;
…but there ought to be a third option that would satisfy everyone:
3/ no compilation while developing, and one compile step at release time to support older browsers.
https://raw.githubusercontent.com/Xe/Xeact/main/xeact.js
New things:
* Array.from instead of the old Array.prototype.slice.call salad
* Object.assign(x, {}) — ooh shiny!
* append(...with_a_splat /* ! */)
They're not happy with React for some reason?
If it's real then they've not explained what's good about this.
If it's trying to say that vanilla JavaScript does the same thing as React then that's not right.
The humour is too indirect/subtle to be clear.
RE: React, to quote my own post:
> All the tools require me to do so much bullshit to get them to even compile. I shouldn't need to compile JavaScript to JavaScript in order to deploy stuff to a webpage. I don't want to give Facebook a grant to any patents I end up creating.
If I'm wrong, then please show the credible references with links.
>>All the tools require me to do so much bullshit to get them to even compile.
This is flat out wrong too unless you're referring to the situation pre 2016 before Create React App.
It's false information.
There's better and more valid criticisms of React such as for example why does it hijack CSS when it really absolutely does not need to and this causes all sorts of problems.
`create-react-app` is great for other people, but other people have different constraints and you cannot expect your experiences to be universally understood and accepted as fact.
No longer true.
> All the tools require me to do so much bullshit to get them to even compile
Tooling has changed quite a bit. Especially with tools like ViteJS. You don't need to configure practically anything and get a project off the ground with develop/build times in milliseconds. I am happy that it is moving in the right direction. This churn was required so the industry could figure out what the pain points really are.
If this is the case, I admit I fucked up and will go correct the post with an addendum.
> Tooling has changed quite a bit.
I just wanna pull in a JS file from `go build` via `go:embed` and have it work lol. I'm not doing rocket science here, I just want thing to go. If it is not less effort than putting static files into a binary then I'm sorry but you've lost me.
To be blunt, it looks like a rehash of a tired trope. The "let's vanilla instead" snark has been a thing[0] since forever.
There's really nothing new or interesting here. `g` is prototype.js' `$`, `h` is basically a hyperscript flavor of the much older domo[1], `u` is `fetch`, `x` is `.textContent = ''`, `r` is on dom content loaded. That's about it, I think? A real curmudgeon writes those from scratch cus fuck npm /s
All the arguments against React are kinda just a display of lack of familiarity w/ the frontend ecosystem. The patent thing is so outdated it's borderline "ok boomer" cringe territory. There are plenty of projects like hyperapp and htmx that are minimalist, free of compiler BS and don't look like a high school kid's hot take on tiktok. And the thing about writing utils from scratch as a vanilla lover is actually semi serious (I've done it myself, as someone who's even developed a React-based framework at work...)
Sorry to OP if this sounds negative, but this is clearly a pretty low effort jab at the "frontend is complex" meme, and "revolutionary" is simply not how I'd describe this, even if I was being very generous.
I'd probably compare this to something like Preact, which is relatively lean. The React API has always been very simple already. It's just all the other stuff people use with it that's the problem.
let content = div({}, [
h3(feed.title),
ul(feed.items.map(item => li([ahref(item.url, item.title)])))
]);
This kind of stuff is way easier for me to deal with than the equivalent in JSX. I don't know why, but It Works For Me :tm:. It also has the advantage of not requiring a separate build step so you can just slap it into a Go binary with a go:embed directive and you're off to the races.Plus as far as I understand it's fairly idiomatic for people to reinvent their own JavaScript frameworks for when they need something between JQuery and React. Xeact (zi-act) is designed to fill that gap. Serve with laundry sauce.
https://github.com/phacility/libphutil/blob/034cf7cc39940b93...
It’s verbose but I learned a lot from it. For example, returning a more specific type than String can eliminate a large class of security / escaping bugs.
No deal.