r/javascript • __proto__ • May 30 '17

Node 8.0.0 released

https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V8.md
319 Upvotes

56 comments sorted by

View all comments

52

u/norlin May 30 '17

and still no native import/export :(

31

u/VertiGuo May 30 '17

5

u/norlin May 30 '17

Yeah, I know, but still there was a hope.

22

u/lachlanhunt May 30 '17

If you'd read that article before, you'd have seen the last paragraph that said:

At the current point in time, there are still a number of specification and implementation issues that need to happen on the ES6 and Virtual Machine side of things before Node.js can even begin working up a supportable implementation of ES6 modules. Work is in progress but it is going to take some time — We’re currently looking at around a year at least.

(Emphasis added)

3

u/DefiantBidet May 30 '17

It's in canary and safari if you wanna play with it ahead of time

1

u/Graftak9000 May 31 '17

It's my understanding the challenge comes from asynchronous loading, so why not start by transitioning to the export/import syntax, then at least some packages will be ES6 module compliant by the time support hits.

1

u/[deleted] May 31 '17

I actually think that they are making the right move here -- import/export in ES6+ is fundamentally async. If they implement their own synchronous version, Node is now using parts of the standard JavaScript language in a non-standard way, which will become all but impossible to ever rectify.

The could extend 'require' to replicate the import/export syntax without using those keywords, but then they are going to be adding syntax into their framework when they know that it is only a temporary stop gap until they can properly implement import/export, which seems more than a little icky.

4

u/nodealyo May 30 '17

Was looking at the change notes for exactly this. Sad times.

1

u/NizmoxAU May 30 '17

I'm not really convinced why it's needed in Node. But it should have been obvious it wasn't coming given it wasn't in v7.

23

u/norlin May 30 '17

It's almost available in browsers, so it's always better to keep things the same way both in browser and in node. And since it's native way in Javascript, it should be used instead of requires.

0

u/[deleted] May 31 '17

[deleted]

5

u/[deleted] May 31 '17

CJS is non-standard JavaScript. The import/export syntax is the standard being adopted in browsers and should be adopted in Node as well.

If we're not getting Node to at least adhere to JavaScript standards then what's the point?

0

u/thepeka May 31 '17

This idea is so painfully out of touch with reality.

1

u/FormerGameDev Jun 02 '17

I'd vote for a separate branch that ditches CJS and just uses ES6. I'd use it, at least in some things.

2

u/dvlsg May 31 '17

I mean, it's not needed, but being able to statically analyze modules sure would be nice.