Using ES modules natively in Node.js

Using ES modules natively in @nodejs:  by @rauschma #ReactJS #Javascript

  • Tip: if you don’t switch on any of the unlockables (extra features), you’ll stay 100% compatible with native ES modules on Node.js.
  • The current plan is to make ES modules available by default in Node.js 10 LTS.
  • Node.js has to be able to detect whether a file contains a CJS module or an ES module.
  • You can read about the alternatives in a separate blog post.
  • More information on ES modules in Node.js and browsers:

Starting with version 8.5.0, Node.js supports ES modules natively, behind a command line option. Most of the credit for this new functionality goes to Bradley Farias.
This blog post explains the details.

@HappyFunCorp: Using ES modules natively in @nodejs: by @rauschma #ReactJS #Javascript

Starting with version 8.5.0, Node.js supports ES modules natively, behind a command line option. Most of the credit for this new functionality goes to Bradley Farias.

This blog post explains the details.

The demo repository has the following structure:

Tip: if you don’t switch on any of the unlockables (extra features), you’ll stay 100% compatible with native ES modules on Node.js.

Yes it is – on Node.js. Browsers don’t care about file extensions, only about Media Types (see previous question).

was the right choice (but you can make up your own mind if you read the linked blog post).

Using ES modules natively in Node.js