>
> 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.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss