Hacker News new | ask | show | jobs
by stincity 3545 days ago
I get NPM for backend development but I don't understand why frontend developers require NodeJS just to utilize it's package management. It really does not make any sense to me considering that NodeJS is server side javascript. If my backend is Python or Go or .NET or Java or whatever, now I'll need NodeJS for the frontend and only for NPM (and now this). It's a reason why I don't enjoy dealing with "modern" frontend technologies.
2 comments

Is requiring Node really that bad? I don't write Bash or Ruby or Python or Go, but I have them all installed because various tools need them.
It doesn't make sense to require a backend tool for frontend technologies. That's just me though. So that's why I'm asking. Couldn't they just create a package system that's not based on some backend tech?
If you're writing a tool that's written in Javascript, you need an implementation of Javascript to make it work. Node, while focused on being "Javascript on the server", is also a really convenient way to get going with a Javascript runtime.

So yeah, in theory, you could create a whole 'nother binding to a runtime just for front-end tooling. Nobody's found node lacking enough to do that.

I guess I don't understand. How would you fetch/build/etc frontend JS files without some sort of backend technology?

(Also don't forget that frontend JS has to target dozens of subtly different browsers, so we unfortunately need to "build" JS files to account for backwards compatibility, etc)

We have that and it's called `bower`. We moved away from it because having two package managers to manage javascript (one for front-end and one for back-end) is more insane than the issue you described.
Love that. Let's include a backend tool for just so our frontend stuff can work. Makes sense.
developers use node to compile whatever version of javascript they are using with a version that will run in most browsers without issues. It's also useful when concatenating and minifying assets. It's called an asset pipeline where you build a release, just like when you compile and package your Java,.NET or Go code before deploying it. Now of course javascript is a dynamic language and should not need all that stuff ... in theory ... but for some reasons developers love complexity. You can design the most simple system the most simple language, developers will find way to add layers of layers of complexity one way or another ... before going back to square one. It's interesting you are talking about Go. right now Go is quite simple, You bet your ass it will look like Java in 10 years just like Javascript is becoming more and more complex with tons of tools, transpilers and what not.