Exploring competitive features in Node.js v18 and v19

(blog.logrocket.com)

54 points | by unripe_syntax 504 days ago

9 comments

  • hliyan 504 days ago
    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.
    • satvikpendem 503 days ago
      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.

    • christophilus 503 days ago
      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.
  • singularity2001 503 days ago
    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

    • spartanatreyu 502 days ago
      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.

  • winrid 504 days ago
    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...

    • throwaway0asd 504 days ago
    • hinkley 503 days ago
      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.
    • wdb 503 days ago
      It’s a shame ESM gets forced through your throat these days
  • nsonha 503 days ago
    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.
    • nl 503 days ago
      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.

      • nsonha 503 days ago
        excluding node_modules, there is already a popular tool that does it since forever: node-dev
        • nl 503 days ago
          Yes of course. Doing the same thing in node is clearly how it should work.
  • ilaksh 503 days ago
    The snapshot feature seems really interesting.
  • idontwantthis 504 days ago
    Does the test library have full mocking support?
  • Alifatisk 504 days ago
    ”Competetive features”
  • Katie69 503 days ago
    undefined
  • Waterluvian 504 days ago
    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.

    • christophilus 504 days ago
      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.
      • llanowarelves 504 days ago
        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.

        • satvikpendem 503 days ago
          > 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.

      • Etheryte 503 days ago
        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.
        • christophilus 503 days ago
          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.
          • Etheryte 503 days ago
            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.
    • beeandapenguin 504 days ago
      That’s the thing. I think Node is struggling to keep up with pace of web platform standards.
      • Waterluvian 504 days ago
        It does feel like that. I’m rather surprised to learn that Fetch is landing now?
        • beeandapenguin 504 days ago
          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

    • throwaway0asd 504 days ago
      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.
      • rpep 503 days ago
        It’s trivial but not useful when good solutions already exist
      • nsonha 503 days ago
        No it’s very not, show us your trivially written test runner
        • hinkley 503 days ago
          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.