I am contemplating moving from Dart to ES6 but Chrome doesn't seem to support the new import statement which is critical to me.
I used the (named export) code from this site: http://www.2ality.com/2014/09/es6-modules-final.html
I tried it even with
<module import="main"><module> I get the error: "Unexpected token import"
Any information if they will support it before the final release ?
code:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>ES6</title> </head> <body bgcolor="blue"> <script type="module" src="main.js"></script> </body> </html> main.js
import { square, diag } from 'lib'; console.log(square(11)); // 121 console.log(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)); }