Live data from Hacker News

Writing JavaScript without a build system

jvns.ca

31–40 of 187 posts

Re: Writing JavaScript without a build system

#31

A lightning rod of an idea I’m sure, but would it help if typescript was accepted by browsers but ignored? Then I can write my typings in-line rather than in comments, and check them, but not have to transpile. I guess “enum” as a special snowflake would fail this. Where I’m coming from is that I can live without most build steps for a small project… but I can’t live without typescript.

Already being proposed! Would be really cool https://devblogs.microsoft.com/typescript/a-proposal-for-typ...

Re: Writing JavaScript without a build system

#32
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.

Re: Writing JavaScript without a build system

#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 issues are fixed when using the correct Node version, the only other problem that can occur is if you switch architecture (eg. x86 => ARM).

Re: Writing JavaScript without a build system

#35
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.

You can easily build complex UIs without a framework. Chrome DevTools, Chrome OS, Photoshop, Firefox and other very complex apps have been built with web components.

Re: Writing JavaScript without a build system

#36
AMD was a great module system precisely because the build step was optional. Running the build helped on large projects (for bundling, minifying, etc.), but you could literally deploy your frontend's `src` directory to production and expect it to work as-is. A nice side-effect was that local development only required a simple file http service.

I'm hoping ES module tooling, import maps, etc. get us back to that point.

Re: Writing JavaScript without a build system

#37
post #6

All those extraneous elements to Javascript are a real turn-off. Python: batteries mostly included. Javascript: feels like you need to drag a dozen suitcases along anytime you embark on any non-trivial project.

Anecdotally I have had the exact opposite experience. JavaScript projects generally work after running `npm install` and then running a single build command.

Python projects (in my personal experience) require jumping through a lot of hoops to get dependencies working correctly.

It could be my experience with Python is just bad luck!

Re: Writing JavaScript without a build system

#38

> But my experience with build systems (not just Javascript build systems!), is that if you have a 5-year-old site, often it’s a huge pain to get the site built again. 5 years? More like 5 minutes in my experience. I probably spend 50% of my time trying to figure out why the build system is breaking, again.

[deleted]

Re: Writing JavaScript without a build system

#39
Regarding Tailwind 3, there's no longer a pre-generated CSS option, but a build process isn't strictly necessary. You can load the library through a CDN URL [0] and the classes will be generated in the browser. It's not recommended for production use though, so if Tailwind 2 has everything you need it's probably the better choice.

[0] https://tailwindcss.com/docs/installation/play-cdn

Post reply on HN