DEV Community

loading...
Cover image for Node v14.3.0 released. Bye Deno?

Node v14.3.0 released. Bye Deno?

wobsoriano profile image Robert ・1 min read

One of the most epic releases lately. Top-Level Await and named imports from CJS modules are now supported in v14.3.0.

Like Deno, it’s now possible to use the await keyword outside of async functions.

Let’s take a look at an example.

We will fetch a random user from a API and say hello.

// hello.js
export const sayHello = (name) => `Hello, ${name}!`;
// index.js
import axios from "axios";
import { sayHello } from "./hello.js";

const { data } = await axios.get("https://api.namefake.com/");

console.log(sayHello(data.name));

Add the type property in your package.json file with value of module.

{
  "name": "node-14.3.0",
  "version": "0.0.0",
  "main": "index.js",
  "type": "module",
  "dependencies": {
    "axios": "^0.20.0"
  }
}

Run it with the --harmony-top-level-await flag.

node --harmony-top-level-await index.js

Output:

Hello, Miss Mellie Mosciski!

When Node finally supports remote imports, then it's a nail in the coffin for Deno.

Cover photo by @cookiethepom on Unsplash

Discussion (9)

pic
Editor guide
Collapse
_bigblind profile image
Frederik πŸ‘¨β€πŸ’»βž‘οΈπŸŒ Creemers

Bye deno is a catchy headline, but I think deno has way more goals, like being secure by default, only granting file/network/... permissions to modules that need it, built-in TypeScript support etc.

Collapse
jonyk56 profile image
Jonyk56

I don't think deno will die cause of this, but, I can guarantee that node will have every use that deno has in the near future, so, at some point, deno Will die because of nodejs updates.

Collapse
shubhamsinha profile image
Shubham Sinha

Programming languages don't die. And just like actual language ( English, Spanish ) the ones you use most comes more naturally to you. Millions of PHP devs are earning more than a guy who's busy finding node vs deno, go vs rust etc. Also if your product grows, you won't be using 1 programming language. Please stop publishing clickbaity articles.

Collapse
wobsoriano profile image
Robert Author

Why is PHP mentioned here ✌️JavaScript of course wont die 😁

Collapse
samrocksc profile image
Sam Clark

Wow, this is like a slam piece for like no reason. Deno has a lot more to offer than a top level await. Perhaps you could have rephrased this to "Node receives top-level await". Deno is a wonderful language with a lot of use cases that I've used GoLang for in the past instead of node.

This is a completely uninformed article. Native native typescript support, no node-modules, easier bundling...

And like folks have mentioned: Languages don't die...

Collapse
nektro profile image
Meghan (she/her)

The appeal of Deno isn't top level await. It's native TypeScript support

Collapse
pedropalhari profile image
Pedro Palhari

Coding native modules using N-API sucks, coding native modules on Rust for Deno has been a breeze. Enforcing typescript is the difference between editors like VS Code being gods or being colored note taking apps.

The thing I like less about Deno is the remote imports, having a (popular) centralized package manager is the only reason Node has become what it's currently today (maybe github with their packages will be a light on Deno, idk yet).

It's not only features, top level await is ridiculously small compared to first-class typescript support. I can code a babel plugin that solve my remote imports in an afternoon but I can't make typescript development in Node more streamlined (at least not in the level Deno is attempting to).

Collapse
patarapolw profile image
Pacharapol Withayasakpunt

Is first class TypeScript support that important? It still internally compiles to Javascript, though. Also, you can create tsconfig.json and add additional options.

However, among the most important, I think it is security, and web browser like modules (i.e. ditching commonjs).

Anything that lived long enough will suffer from backward compat.

I am still half hearted about not supporting gyp, relying only on web assembly.

Collapse
bajix profile image
Thomas Sieverding

Deno's foundation is better than that of Node. Rust Lang is boss