-
Notifications
You must be signed in to change notification settings - Fork 0
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
Default Exports #9
base: master
Are you sure you want to change the base?
Conversation
This es6 seems unintuitive at first glance. What are your thoughts on something like: export default Hello;
exports.default.foo = 'dwq'; I don't like overwriting |
I think mounting on exports.default is wrong because it's implementation specific to the compiler. How about just renaming exports to defaultExport Julian Krispel-Samsel
|
I suppose that is true, since we haven't settled on a compiler yet. What about the following: const defaultExport = Hello;
export default defaultExport;
defaultExport.foo = 'dwq'; That way any references to |
Ok cool. It seems to me like it's pretty conventional to put the export statement at the bottom of a file but if you have a good reason for having that at the top that seems fine. I don't really care too mucg either way tbh. Whaddayasay Julian Krispel-Samsel
|
That seems to work for me though. The thing about not being compiler specific is not just about us choosing a compiler but also user-land. Ideally this should work with whatever other peeps are using. Whether that's webpack or browseriify or whatever else Julian Krispel-Samsel
|
@yofreke also bear in mind you can define exports as a normal variable and babel will adjust to prevent any collisions at compile time - here's and example
will compile to
|
Alpha = exports = function() { console.log('boom'); } | ||
Beta = exports.boing = yoyoyo; | ||
export default exports; | ||
var defaultExports; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let
So in light of the issues discovered in this pr I'm now changing the exports mod to be much simpler. cc @yofreke
Here's what I'm doing:
So basically this:
becomes this: