-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix #145 - export {foo as bar}. #169
Conversation
Note: depends on esperantojs/esperanto#169.
Related question: is there any particular reason to use getters when defining the export object, rather than just static files? Like, instead of: var index_js = {
get mouse () { return mouse; },
get namespace () { return namespace; },
get namespaces () { return namespaces; },
get requote () { return requote; },
get select () { return select; },
get selectAll () { return selectAll; },
get selection () { return Selection; },
get touch () { return src_touch; },
get touches () { return src_touches; }
}; You could produce: var index_js = {
mouse: mouse,
namespace: namespace,
namespaces: namespaces,
requote: requote,
select: select,
selectAll: selectAll,
selection: Selection,
touch: src_touch,
touches: src_touches
}; |
@mbostock I believe it's because ES6 imports and exports are live bindings, so if you make a module object (i.e. // a.js
export var count = 0;
export function increment() { count++; }
// b.js
import * as a from './a';
console.log(a.count); // 0
a.increment();
console.log(b.count); // 1 |
Ah, of course: bindings, not values. Thanks! (And hi!) |
Hey Mike! Nice to run into you here. I'll have to check out d3-bundler. |
Thanks @mbostock, I've added a regression test and released this as 0.7.1. There is an That said, I was thinking about d3-bundler on the way home and I think there might be a simpler way that sidesteps the issue... let me run a couple of experiments. |
👍 Thanks for adding more tests. I tested against master and it still appears to work, but please |
Oops, thought I had, sorry - it's published now |
Fixes #145. I’m not really sure this is the right fix, but it seemed to work?
Note: I purposely did not include the built changes to dist/. I’m assuming you’d like to test on your end, but I can include them if you want.