DEV Community

loading...

Discussion on: Writing ES6 in your Node.js Applications

Collapse
kepta profile image
Kushan Joshi

I think in 2018 you would want to avoid transpiling your code to ES5 as the support for it is already there.

Node v8 and v10 are pretty much on par with the latest ES20XX and if you are using Node v6 you still get most of the es2015 goodies except for async/await, double check on node.green.

If you are using something below v6, you have bigger things to worry about anyway...

Collapse
dhruv profile image
Dhruv Author

Not all es6 features are implemented and they are behind the flag and in the experimentation, you have to use the .mjs extension to use it.

The latest v10 will have it all the features in it including the dynamic imports. But v10 still won't be the LTS version and not everyone will be using it.

Collapse
kepta profile image
Kushan Joshi

My point is that you don't need Babel to use modern ES6 features. If you could tell me which ES6 feature you are getting by using Babel. If you are talking about ESM (EcmaScript Modules), Babel doesn't really give you ESM it simply allows you to write the import x from y style and transpiles it back to CJS.

Thread Thread
danl profile image
Dan L.

I'm using Node 10.16.0. Is ESM best way to enable ES6 for NodeJS? (I currently use 'nodemon -r esm')

thanks!