r/javascript • • Apr 23 '19

Introducing Node.js 12

https://medium.com/@nodejs/introducing-node-js-12-76c41a1b3f3f
333 Upvotes

85 comments sorted by

View all comments

91

u/[deleted] Apr 23 '19

ES6 Module Support!

47

u/jsnoobie Apr 23 '19

No more red squiggly line in vscode under the β€œre” on my require statements!

I was a little ocd about that one

23

u/tanguy_k Apr 23 '19 edited Apr 23 '19

It's still behind a flag (--experimental-modules) + you need to add "type": "module" inside your package.json.

See https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff

17

u/[deleted] Apr 23 '19

Yes, but they expect to remove the need for the flag during the development of this version (before it goes LTS in October).

8

u/ShortFuse Apr 24 '19

Do I still need to use Michael Jackson Script file extension?

I've been using the esm package, but I would like to be able to remove the dependency?

3

u/[deleted] Apr 24 '19

You don't. If you add "type": "module" to your package.json, plain .js will work too.

7

u/k4kshi Apr 23 '19

Still not the end goal but we're getting closer

3

u/Baryn Apr 24 '19

Screw MJS! πŸŽ‰