domenic at domenicdenicola.com (2014-02-04T20:55:15.482Z)
> ```js
> var projs = [
> require('./projections/merc'),
>
> require('./projections/longlat')
> ];
> ```
With ES6 modules, you might do something like this:
import merc from "./projections/merc";
import longlat from "./projections/longlat";
var projs = [merc, longlat];
Or if you're importing the modules themselves:
module merc from "./projectsions/merc";
module longlat from "./projectsions/longlat";
var projs = [merc, longlat];
> is there a reason [import] can't be an expression which evaluates to
> either an object with all the [exports] or the default export when it's
> used as an AssignmentExpression (I think I'm using that one right).
>
>
Yes. ES6 modules are "statically linked", meaning that all of the
non-local (imported) bindings are resolved *before the module begins
executing*. It's an important distinction.
Because of this difference, you can expect usage patterns to turn out
somewhat different from the "require" patterns we are used to seeing in
node.
> > var projs = [ > require('./projections/merc'), > > require('./projections/longlat') > ]; > > With ES6 modules, you might do something like this: import merc from "./projections/merc"; import longlat from "./projections/longlat"; var projs = [merc, longlat]; Or if you're importing the modules themselves: module merc from "./projectsions/merc"; module longlat from "./projectsions/longlat"; var projs = [merc, longlat]; > is there a reason [import] can't be an expression which evaluates to > either an object with all the [exports] or the default export when it's > used as an AssignmentExpression (I think I'm using that one right). > > Yes. ES6 modules are "statically linked", meaning that all of the non-local (imported) bindings are resolved *before the module begins executing*. It's an important distinction. Because of this difference, you can expect usage patterns to turn out somewhat different from the "require" patterns we are used to seeing in node. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140130/5ceb4d26/attachment.html>