Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 Modules Support #4868

Closed
d3x0r opened this issue Jan 25, 2016 · 2 comments
Closed

ES6 Modules Support #4868

d3x0r opened this issue Jan 25, 2016 · 2 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@d3x0r
Copy link
Contributor

d3x0r commented Jan 25, 2016

example code...

//------ main.js ------
import * as lib from 'lib';

console.log(lib.square(11)); // 121
console.log(lib.diag(4, 3)); // 5
//------ lib.js ------
export const sqrt = Math.sqrt;
export function square(x) {
    return x * x;
}
export function diag(x, y) {
    return sqrt(square(x) + square(y));
}

//------ main.js ------
import { square, diag } from 'lib';
console.log(square(11)); // 121
console.log(diag(4, 3)); // 5

Even with the flag --harmony_modules nodeJS fails....

M:\javascript\module-test>h:\dev2\nodejs\node --harmony_modules main.js
M:\javascript\module-test\main.js:2
import * as lib from 'lib';
^^^^^^

SyntaxError: Unexpected token import
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:430:10)
    at startup (node.js:141:18)
    at node.js:1003:3
@evanlucas
Copy link
Contributor

ES6 module support is not complete at this time. Dupe of #2760

@ChALkeR ChALkeR added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Jan 25, 2016
@dandv
Copy link
Contributor

dandv commented Jan 15, 2017

Fortunately, current version of node report nonexistent harmony flags: bad option: --harmony_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

4 participants