Ecmascript 6 support on Node.js

后端 未结 3 1031
情歌与酒
情歌与酒 2021-02-07 21:13

I\'ve been working with KoaJS for a while, and we can easily use the \'let\' keyword and the generators when using the --harmony flag but I couldn\'t find how much support for

相关标签:
3条回答
  • 2021-02-07 21:54

    You can use ~96% of ES6 features in Node.js 6. You can review support for all versions on http://node.green/

    0 讨论(0)
  • 2021-02-07 21:58

    With regards to your second question, yes, there is es6-module-loader. For a long list of transpilers, shims, and other tools for using full ES6 features now, see addyosmani's ECMAScript 6 Tools page.

    As for native ES6 support in node.js, V8 officially implements "ECMAScript" but AFAIK the V8 project doesn't release a spec of their implementation. However there are some sources of useful information out there. Here's a brief overview of ES6 in node.js v0.11.6.

    You may want to determine the version of V8 that your version of node.js uses. See the node.js blog for recent changelog info. It can also be useful to find the version of V8 used in a given Chromium release. The Chrome release notes can be found here. Keep in mind that different flags can be set for the same version of V8. Chromium and node.js both have ways to set flags in V8 related to ES6 support.

    Here are two tables that list ES(6) feature support across implementations:

    • http://pointedears.de/scripts/test/es-matrix/
    • http://kangax.github.io/compat-table/es6/

    This MDN page lists a set of reference articles for ES6 language features. At the bottom of each one you can see the status of Chrome support for that feature (and using V8 versions determine the support in node.js).

    Finally, the V8 issue tracker provides a list of issues related to ES6 features, many of which have been implemented and their issues closed.

    0 讨论(0)
  • 2021-02-07 22:02

    This does not concern node 0.11, but in the current 5.8.0, you can use --harmony_default_parameter.

    It it scheduled to be included by default in v6.0.

    0 讨论(0)
提交回复
热议问题