Hacker News new | past | comments | ask | show | jobs | submit login
Exploring competitive features in Node.js v18 and v19 (logrocket.com)
54 points by unripe_syntax on Dec 2, 2022 | hide | past | favorite | 30 comments



Good. A reduction in dependencies and tooling. Once matured, no more: isomorphic fetch, pkg, nodemon, mocha/jest. Now if we can do the same for webpack and typescript, that would be great. There must come a day when a developer can bootstrap a reasonably sized Node project with just the built in tooling.


Deno does this by default, plus you can use npm packages in Deno as well. It also has a compile option that turns the entire project into a binary you can deploy, which is great to not have to ship source files and run them with Node as is usually the case.

For the frontend, Vite works well, and NextJS if you're using React in particular.


This is why I’m excited about Bun. I’ve built a handful of 0-dependency utility web apps (internal company tooling) with it. It’s early days, but it’s already quite good.


import test from 'node:test'; ^^^^^^

Uncaught: SyntaxError: Cannot use import statement inside the Node.js REPL, alternatively use dynamic import

import test from 'node:test'; ^^^^^^

SyntaxError: Cannot use import statement outside a module

import test from 'node:test'; ^^^^^^ error: Unsupported scheme "node" for module "node:test".

This whole import / require / ... debacle is what drives me away from JS the most


You'd probably like deno...

It's typescript, web standards only (no require, top-level-await, no module messaround), and built-in test runner from the start.


I love how they make it sound like Node/v8 gets faster every release. That's not the always the case, remember to benchmark! :p

https://user-images.githubusercontent.com/3397140/86506040-a...



I don’t think I’ve gotten free performance since Node 12. There’s a little juice in Node 16 for async code and certain class patterns but those are mostly avoiding penalties, not getting new benefits.


It’s a shame ESM gets forced through your throat these days


This watch thing seems pretty simplistic, does it just watch the entry point? A directory? The default should be watch all files in dependency graph.


Dependency graphs in the JS ecosystem are notoriously large.

I certainly wouldn't want this because of the huge number of dependencies.

Watching a src directory is usually the way to go.


excluding node_modules, there is already a popular tool that does it since forever: node-dev


Yes of course. Doing the same thing in node is clearly how it should work.


The snapshot feature seems really interesting.


Does the test library have full mocking support?


”Competetive features”


My initial reaction is:

We’re supposed to be thrilled about a years old API finally landing in Node? A built-in test system when there’s so many great choices by not being batteries included? A standard update to catch up to the latest Chromium?

Other than the fourth point (yay a better watch mechanism!) this actually persuaded me to think that maybe Node is stale.

Well… not stale. Stable. Maybe at my ripe old age of 36 I’m a curmudgeon, but I think it’s fine to just focus on maintenance mode and following the browser for API and feature guidance.


I'm 100% in favor of being able to do more things with fewer dependencies, so yes. I think having watch, test, and fetch built in are great.


I agree. I am glad Node is getting there despite dragging its feet. The DX with all the package boilerplate is atrocious compared to what it could be.

Even if Deno, Bun etc were to fizzle out, I am glad they exist to show the way and put pressure on Nodejs at bare minimum.


> Even if Deno, Bun etc were to fizzle out, I am glad they exist to show the way and put pressure on Nodejs at bare minimum.

This is how I felt about io.js back in the day too, and about vim versus neovim; competitive pressure works.


This is a slight misnomer in my opinion. When those dependencies are bundled into Node you have fewer listed dependencies, yes, but you haven't actually reduced the amount of external code you rely on.


You have a single vendor to worry about— like Microsoft when you use .NET, Google when you use Go, etc. You obviously will always have external dependencies unless you build everything from your own hardware up. But it’s clearly a win to vet and trust one vendor, and have one solid, trusted platform to build on vs pulling in literally thousands of dependencies from random vendors as is common in most JS stacks.


That's a fair point. Currently I'm not convinced all of this is the right direction for Node, but we'll see how it pans out. Node is already huge so I would much rather they pick their battles and do those features well, rather than try and be mediocre at everything.


That’s the thing. I think Node is struggling to keep up with pace of web platform standards.


It does feel like that. I’m rather surprised to learn that Fetch is landing now?


Yea for real. I’m sure there’s tons of reasons why it took so long, there’s gotta be some devil in the details. Maybe the standards compliance, complexity of the code base, something something “ecosystem”, all the above…

Feels like a similar situation to CJS/ESM, which is still a headache in Node regardless of its support


Test runners have been super requested lately in the Node GitHub issues. I have not understood why that is because writing a test running of your own is trivial.


It’s trivial but not useful when good solutions already exist


No it’s very not, show us your trivially written test runner


And then the terrible tests you wrote for your terrible runner.

The bookkeeping isn’t hard, but the matchers and the lifecycle bits get tricky.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: