Live data from Hacker News

Writing JavaScript without a build system

jvns.ca

151–160 of 187 posts

Re: Writing JavaScript without a build system

#151

The real question is why do we need React, Webpack, Tailwind, sass, jsx, etc. I've been developing web apps for the last few years and I really can't understand why all these are needed. They do not make my life easier as a developer, nor they make the code more readable. I've asked around why do we need, for example, React, and never gotten a straight answer.

How do you keep changes between the DOM and JS in sync without a framework? This is, from my understanding, the main value they provide.

Re: Writing JavaScript without a build system

#152
post #15

The appeal of JavaScript when it was invented was its immediacy. No longer did you have to go through an edit-compile-debug loop, as with Java, or even an edit-upload-debug loop as with a Perl script, to see the changes you made to your web-based application. You could just mash reload on your browser and Bob's your uncle! The JavaScript community, in all its wisdom, reinvented edit-compile-debug loops for its immedi…

> The appeal of JavaScript when it was invented was its immediacy. You can still do that. Nothing has changed. It's probably gotten even easier. Have fun implementing a complex UI without some sort of component Framework though.

There are component frameworks that don't require a build step.

Re: Writing JavaScript without a build system

#154

The real question is why do we need React, Webpack, Tailwind, sass, jsx, etc. I've been developing web apps for the last few years and I really can't understand why all these are needed. They do not make my life easier as a developer, nor they make the code more readable. I've asked around why do we need, for example, React, and never gotten a straight answer.

How do you keep changes between the DOM and JS in sync without a framework? This is, from my understanding, the main value they provide.

By adding event listeners to the DOM elements that may receive updates?

I don't see why you _have to_ use a framework for that. Have people forgotten to write simple code using basic JavaScript?

Re: Writing JavaScript without a build system

#155
post #153

wait.. Tailwind is a big CSS file?

Tailwind is a too-big CSS file. If you want to use Tailwind, you must use a builder. This guy is clueless.

   wget https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css
  HTTP request sent, awaiting response... 200 OK
  Length: unspecified [text/css]
  Saving to: ‘tailwind.min.css’

  tailwind.min.css               [                                   ]   2.80M   321KB/s    in 10s     

  2023-02-17 18:44:58 (286 KB/s) - ‘tailwind.min.css’ saved [2934019]

In short: 2.8 megabytes, 10 seconds for the download.

From the post:

> but Tailwind 3 doesn’t seem to be available as a big CSS file at all anymore […] so I’m going to keep using Tailwind 2 for now

Gee I wonder why. The length people go to make internet worse for everyone…

Re: Writing JavaScript without a build system

#156
I resonate with this topic. Checking your own repos on a new computer is one thing… inheriting someone else’s project and running it on your machine in the node ecosystem is very rough.

Anyways, I made a slightly more advanced buildless vue project here: https://github.com/kyleparisi/buildless-vuejs

It has the advantage of using .vue files which I enjoy. Oh and guess what… it has code splitting because you have to define what components the page needs ;).

Re: Writing JavaScript without a build system

#157
post #33

Getting older projects to run was a huge pain for me when I started working with JavaScript, but I have found two easy steps to get around this: 1. Use nvm + an .nvmrc file in your project to pin the major version of Node.js you are using. I recently got a five year old Node 8 project up and running with no issues using this method. 2. Try to avoid packages that has binary dependencies (like node-sass). 99% of binary…

Why rely on nvm to pin the NodeJS version you are using? That's natively supported as a field in your package.json [0], assumimg you're using npm/yarn/pnpm (you are). Example: { "engines": { "node": ">=0.10.3 Also, god forbid you are actually running anything using Node 8 and whatever dependencies you have there, that's a recipe for security disaster. The truth is that to use the NodeJS ecosystem we must have the dis…

npm can't install the correct version of Node to use automatically, but nvm can using "nvm i"

Re: Writing JavaScript without a build system

#158
post #76

The fact that ES2015 was not backward compatible opened the Pandora's box to the plethora of build-system-only libs. Now the browser and your application are too distant. Exposes the dev to a world of tooling but increases friction on building, points of failure and complexity. Recently we are trying to fit them again and this post is a useful guide to do it

[deleted]

Re: Writing JavaScript without a build system

#159
post #5

Use npm to install libraries one time only. Try to use as few dependencies as possible. You don't need a framework--components are achievable without vue and react etc. Server side rendering and VDom are really not needed for most projects. Think of Programming in JavaScript, CSS and F5 rather than Typescript and SASS as the equivalent of Marcus Aurelius' Stoicism.

> npm > Try to use as few dependencies as possible. Hahaha. You joke.

Yeah that is annoying I must admit. You can create a nice server with just node but when you import something like a markdown parser or a sqlite driver then then your modules folder quickly fills up...
Post reply on HN