我正在使用node.js v4.0.0,并试图使一些代码正常工作,而不需要首先对其进行转换。虽然大多数人都在工作,但我不能用
import这可能是因为没有最后确定的阶段,但我也找不到一个标志,使它。我都试过了:
--harmony_modules (enable "harmony modules" (in progress))
--harmony_array_includes (enable "harmony Array.prototype.includes" (in progress))
--harmony_regexps (enable "harmony regular expression extensions" (in progress))
--harmony_proxies (enable "harmony proxies" (in progress))
--harmony_sloppy (enable "harmony features in sloppy mode" (in progress))
--harmony_unicode_regexps (enable "harmony unicode regexps" (in progress))
--harmony_reflect (enable "harmony Reflect API" (in progress))
--harmony_destructuring (enable "harmony destructuring" (in progress))
--harmony_sharedarraybuffer (enable "harmony sharedarraybuffer" (in progress))
--harmony_atomics (enable "harmony atomics" (in progress))
--harmony_new_target (enable "harmony new.target" (in progress))(说我没有用regexp做这件事也没用.:)
虽然我知道导入的原因,但我不明白为什么默认参数会失败,因为它们似乎已经完成,而且我也找不到一个似乎可以处理它的标志。
是否有用于导入和默认参数的标志?
不起作用的代码是
class foo extends bar {
constructor(options = {})
....
}错误是
意外
=非法令牌
发布于 2015-09-12 18:16:05
节点4使用Chrome 45附带的V8版本,而V8 v4.5.103.3不附带默认参数,甚至在标志后面也是如此。默认参数落在Chrome 49附带的V8版本中,并将出现在Node 6+中。
发布于 2016-03-25 15:14:35
标志是:--harmony_default_parameters
https://stackoverflow.com/questions/32542085
复制相似问题