DEV Community

Aidan Lovelace
Aidan Lovelace

Posted on • Originally published at aidanlovelace.com on

1

How to use ES6+ with Node.JS

I have seriously come to really like the new features that come with ES6+ Javascript such as async/await, the new class syntax, let and const (screw you hoisting!), arrow functions, destructuring, the new import syntax, and many more. These features are seriously useful. I think that the import syntax in particular makes Node.JS feel so much more like it was made for Javascript.

Ok. Ok. I’ll get on with it—How can I use ES6+ with Node.JS? It’s super simple.

  1. cd to your project in your Terminal

  2. Run npm install --save-dev esm

  3. Run your main Javascript file with node -r esm {THE FILE}

If you are using nodemon, you can just run nodemon -r esm {THE FILE}.

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️