Skip to content

--harmony_modules flag not work  #2976

Closed

Description

@Pana

When use ES6 module feature like this

node --harmony_modules tmp/es6Test.js

it throw an error

import { stat, exists, readFile } from 'fs';
^^^^^^

SyntaxError: Unexpected token import

My node is the 4.0.0 version

Activity

  1. bnoordhuis commented on Sep 21, 2015

    @bnoordhuis
    Member

    Harmony modules aren't implemented yet, see https://nodejs.org/en/docs/es6/. As a rule of thumb, if a feature requires a flag to enable, expect it to be incomplete or broken.

    Duplicate of #518, #2760 and probably others.

  2. Alhadis commented on Nov 5, 2015

    @Alhadis
    Contributor

    Just out of curiosity, why is there even a flag to enable support for an unsupported feature? If it does nothing, it's just confusing a lot of people who're expecting import statements to work...

  3. Fishrock123 commented on Nov 5, 2015

    @Fishrock123
    Contributor

    @Alhadis It comes from a dependency -- V8.

  4. Alhadis commented on Nov 5, 2015

    @Alhadis
    Contributor

    Alright, well, that implies that V8 does support modules to some extent, but any supported features that it exposes are inaccessible to NodeJS. Or am I wrong?

  5. Fishrock123 commented on Nov 5, 2015

    @Fishrock123
    Contributor

    No it doesn't really support modules at this time. Not ES6 modules anyways.

    There was some old "modules" code laying around in there and that flag enables it for testing. Or used to anyways.

    On Nov 5, 2015, at 11:06 AM, John Gardner notifications@github.com wrote:

    Alright, well, that implies that V8 does support modules to some extent, but any supported features that it exposes are inaccessible to NodeJS. Or am I wrong?

    —
    Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions