Re:JavaScript Modules
by pmontra on Wednesday July 02, 2014 @03:24AM
(#7975656)
The syntax is better than the CommonJS one. Check the side by side comparison at http://jsmodules.io/cjs.html
However CommonJS is here now and JS engines might take a while to implement the new syntax. Example: the => (which is in the same ES6 draft) works in FF since version 22 and not in V8 yet.
http://wiki.ecmascript.org/doku.php?id=harmony:specification...
[ Parent
| on HN ]
That is not an honest comparison, though.
import { getCodec } from "iconv-lite";
would be var getCodec = require("iconv-lite").getCodec;Or in CoffeeScript,
{getCodec} = require "iconv-lite"
Explicit dependencies without introducing new syntax? Yes, please.