You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
node --harmony_modules Javascript.js
/Users/tushar.mathur/Documents/Projects/temp/Javascript.js:1
(function (exports, require, module, __filename, __dirname) { import {partial} from 'lodash'
^^^^^^
SyntaxError: Unexpected token import
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:117:18)
at node.js:951:3
➜ temp
Closing. As others point out, ES6 modules are not implemented in V8 yet. As a rule of thumb, if a feature is behind a flag, you can expect it to be half-baked or downright broken.
I have problem with '--harmony' in command, and use AppJS module node --harmony ./app/app.js and after run then have error 'AppJS requires Node is run with the --harmony command line flag' pls help me for this error. I use xubuntu OS node v4.2.2.
have add '--harmony' or no then always show error message 'throw new Error ('AppJS requires Node is run with the --harmony command line flag'); ^
Error: AppJS requires Node is run with the --harmony command line flag
at Object. (/var/www/tutorial/app/node_modules/appjs/lib/index.js:2:9)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/var/www/tutorial/app/app.js:3:11)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)'
AFAIK, V8 still doesn't support import/export, and thus neither does node.js v6.
Reacted by Nikos and Alexander Dines
Reacted by Kristijan Sedlak, Nick Ferraro, Nikos, B.E. Henriksen, Evan Carroll, Serkan Agdelen, Chris Asche, Kyle Pittman, Tony Gentilcore, John Pape and 13 more
Remove --harmony-modules flag and let embedder decide when modules are used
Modules already have a separate entrypoint into the engine (at the moment,
this is v8::ScriptCompiler::CompileModule, though that will change to
something like ParseModule). This meant that requiring a commandline flag
simply added an extra complexity burden on embedders. By removing the v8
flag, this lets embedders use their own flagging mechanism (such as d8's
"--module", or Blink's RuntimeEnabledFeatures) to control whether
modules are to be used.
Also remove old modules tests that were being skipped (since they test
very old, pre-ES2015 modules syntax).
Reacted by Dušan Maliarik, Tony Gentilcore, Tim Erwin, Guilherme Bayer, Atul, Alexander Dines, Erik Cupal, Alican Erdoğan, Kutsan Kaplan, Manu and 2 more
Yeah, keep the ticket closed. Modules in JS will never be truly standardized, and if they will, the standard will be obsolete or deprecated the next day, by a new solution, "new standard". Sad.
Reacted by Paul Merrill, Tony Gentilcore, Dom Vin, Mike Pelley, Nikos, Tim Erwin, Max Ustinov, Florian Wendelborn, Thomas Grainger, Marcin Baszczewski and 11 more
As node 6.5.0 still throws up on import ..., I guess it's still not in V8? Any news on that? http://node.green/ is a great resource, but is there module support shown in any way?
Reacted by David Jones, Florian Wendelborn, Kirk Ouimet, ithinco, Renan Martins Pimentel, Felix Itzenplitz, Atul, Tiger, Akim, Anthony Ross and 10 more
@avesus i believe modules are slated for node 10 (i don't know if they will be backported). however you can use them in nightly builds with --experimental-modules
Activity
fl0w commentedon Sep 9, 2015
Same results here, also on OS X (also with strict mode).
However, I'm not sure it is expected to work - I'm still transforming with BabelJS.
tusharmath commentedon Sep 9, 2015
I guess I tweeted too soon :'(
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>fl0w commentedon Sep 9, 2015
modules are still in 'in progress' in v8 - so I'd withdraw that tweet anyway!
tusharmath commentedon Sep 9, 2015
Well, I wanted to experiment with them without using a transpiler which I finally could (Or can't).
ilkkao commentedon Sep 9, 2015
See this comment: https://code.google.com/p/v8/issues/detail?id=1569#c29
V8 developers are currently waiting WHATWG loader spec to mature before completing the ES2015 module support.
bnoordhuis commentedon Sep 9, 2015
Closing. As others point out, ES6 modules are not implemented in V8 yet. As a rule of thumb, if a feature is behind a flag, you can expect it to be half-baked or downright broken.
nguyenchilong commentedon Nov 30, 2015
I have problem with '--harmony' in command, and use AppJS module node --harmony ./app/app.js and after run then have error 'AppJS requires Node is run with the --harmony command line flag' pls help me for this error. I use xubuntu OS node v4.2.2.
have add '--harmony' or no then always show error message 'throw new Error ('AppJS requires Node is run with the --harmony command line flag'); ^
Error: AppJS requires Node is run with the --harmony command line flag
at Object. (/var/www/tutorial/app/node_modules/appjs/lib/index.js:2:9)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/var/www/tutorial/app/app.js:3:11)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)'
Globik commentedon May 15, 2016
And by now what? Is import implemented in node.js 6.0?
fl0w commentedon May 15, 2016
AFAIK, V8 still doesn't support import/export, and thus neither does node.js v6.
d3x0r commentedon May 15, 2016
https://bugs.chromium.org/p/v8/issues/detail?id=1569
Mar 16, 2016
quantuminformation commentedon May 21, 2016
sad
skrat commentedon Jun 6, 2016
Yeah, keep the ticket closed. Modules in JS will never be truly standardized, and if they will, the standard will be obsolete or deprecated the next day, by a new solution, "new standard". Sad.
cweilguny commentedon Aug 29, 2016
As node 6.5.0 still throws up on
import ..., I guess it's still not in V8? Any news on that?http://node.green/ is a great resource, but is there module support shown in any way?
simonbengtsson commentedon Jan 12, 2017
V8 now has support for modules! And implementation has started in chromium 🎉🏆🎊 https://bugs.chromium.org/p/chromium/issues/detail?id=594639#c9
avesus commentedon Dec 23, 2017
Node 9.3.0 still not supported.
devsnek commentedon Dec 23, 2017
@avesus i believe modules are slated for node 10 (i don't know if they will be backported). however you can use them in nightly builds with
--experimental-modules