I'm using node.js v4.0.0 and am trying to get some code working without the need of transpiling it first. While most is working, I can't use
import
which might be because of the not finalized stage, but I also can't find a flag that enables it. I've tried all of them:
--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))
(useless to say that I didn't use regexps for it... :))
While I get the reason for import, I don't see why default parameters are failing as they seem to be finalized and I can't find a flag which seems to handle it.
Is there a flag for import and default parameters?
The code that doesn't work is
class foo extends bar {
constructor(options = {})
....
}
error is
unexpected
=
illegal token
Node 4 uses the version of V8 that shipped with Chrome 45 - and V8 v4.5.103.3 doesn't ship with default arguments, even behind a flag. Default arguments landed in the version of V8 that shipped with Chrome 49 and will be in Node 6+.
the flag is : --harmony_default_parameters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With