Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

[React Transform HMR] Patching _$Unknown when using ES6 classes with default export #40

Closed
okonet opened this issue Oct 19, 2015 · 5 comments

Comments

@okonet
Copy link

okonet commented Oct 19, 2015

When using export default class extends React.Component syntax, [React Transform HMR] Patching _$Unknown in being displayed in the console instead of the component name.

2015-10-20 at 00 43

vs

2015-10-20 at 00 43

The second one is defined like export default class ImageUploadDropzone extends React.Component

Also I see a lot of _default when getting propTypes warnings. Not sure if this is related to the other issue.

2015-10-20 at 00 43

I'm using React 0.14 and babel-plugin-react-transform@1.1.1

@gaearon
Copy link
Owner

gaearon commented Oct 19, 2015

If it's an anonymous class, I'd say it's expected, isn't it?
Does the class name somehow get inferred without this plugin?

@okonet
Copy link
Author

okonet commented Oct 20, 2015

Well, in this case it should be a file name. At least this is how Babel infers displayNames into it: https://babeljs.io/docs/usage/jsx/

@gaearon
Copy link
Owner

gaearon commented Oct 20, 2015

Did you add Babel displayName plugin before React Transform? Maybe it runs by default but is disabled when you specify plugins explicitly.

In the README we mention that you need to put it before React Transform if you want its behavior.

@okonet
Copy link
Author

okonet commented Oct 20, 2015

Yes, it's there but I believe that this _default issue might be somehow related to this plugin.

@okonet
Copy link
Author

okonet commented Nov 18, 2015

I'm closing this one, since it seems inferring displayName from filename doesn't work with ES2015 classes: https://phabricator.babeljs.io/T1331

@okonet okonet closed this as completed Nov 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants