-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Static properties on components #578
Comments
Looks like #193. |
I think this is more in line with #480 (comment) — how does that proposal sound? |
I think that proposal solves the problem. My only reservation is that it seems more frameworky than this as setup would be a runtime thing vs compiling to the proper class. |
One thing that's not clear to me is with this proposal whether |
The only thing that gives me pause is interoperability — at the moment, When you start throwing named exports into the mix, you have to start doing things like this... exports['default'] = Component;
exports.meta = 'my meta data'; ...which inevitably ends up causing all sorts of headaches that are impossible to anticipate. I may be overly sensitive to that sort of thing, having been through the trenches with Rollup, but given that there really isn't a scenario where you'd need the named export but not the default one, to me it feels simpler to just add |
@Rich-Harris couldn't you could simply translate it to the following? module.exports = exports = Component
exports['default'] = exports
exports.meta = 'my meta data' Or even module.exports = exports = Component['default'] = Component
exports.meta = 'my meta data' |
I seem to remember there being some reason why that also causes problems, though I can't remember for the life of me what it was. Possibly something to do with assumptions made by other tooling. Or I could be imagining it... |
@Rich-Harris I can't seem to recall anything like that. Although tools like babel will check for |
Currently as far as I can tell this is not possible.
I would imagine it would be something like:
Then you could consume this programatically like so:
I think this would be handy to have and am curious what others think and if there are other ways to achieve this effect (perhaps using methods as getters).
The text was updated successfully, but these errors were encountered: