-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ReferenceError: Can't find variable from example (problem with component displayName, "ProxyClass" is used) #63
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
Comments
also strange, I just added a second component (by adding an example for it) but I don't see it in the listing even after restarting the server. I wonder if it also is coming in as |
did you try explicitly adding |
nope, I'll give that a try. I didn't see that in the examples, but not sure what I'm doing differently. Does it work in the examples because components are in folders? |
yep, this fixes things |
I don't know what exactly you do differently, but if you see Still note that what I'm saying is only a workaround and we should still fix the underlying bug or at least provide some friendly error message. |
no worries! I'm happy to help debug where I can. I'm primarily a designer so my javascript knowledge isn't as deep as it could be. |
okay, so if adding @sapegin, 2 things:
|
I didn't see anything about that plugin in the setup or the example project, but maybe I'm missing where its defined. |
|
2: So let's do it! Do you think it's better to try to detect the name (like I did someday), or to throw an |
so I'm guessing that my error is that I'm using an older version of babel? I'll try updating and see if that helps. |
No, I don't think so. And styleguidist is using the old (5) version anyway. Could you post your class definition? (I mean the lines around |
and then
|
Hmm, so, as you can see in the Babel REPL, this should add the displayName. Maybe you could check if the |
so when I build the styleguide I see display names:
but when running
and from the console:
|
I think I got it. It's gaearon/babel-plugin-react-transform#19... And I was able to reproduce this with a simple example using The above ticket has this info:
@sapegin, could you check that this is true for the webpack config? I don't understand how exactly these plugins are loaded. |
I’ll try to add |
Looks like this will be fixed with the next Babel release. We would just need to update to Babel 6... |
Is there some workaround until its fixed? Except put displayName everywhere.. |
Don’t know. Can anyone try to update to Babel 6 and check and/or send PR? |
Please try 2.0.0-rc with Babel 6. |
Feel free to reopen if you still have this issue. (2.0.0-rc4) also have a fallback to file name or folder name if it can’t detect component name in runtime.) |
I'm trying to get up and running and I think I'm getting pretty close. However I'm having an issue with my first component. I'm using a file called
Button.jsx
that has aconst Button = React.createClass({
andexport default Button;
at the bottom. I have styleguidist setup like so:when I view the style guide I see
ProxyClass
where I would expectButton
then in my example I get:ReferenceError: Can't find variable: Button
all the docs from the file are fine and the example code is there and looking ok, just no preview or component name.
The text was updated successfully, but these errors were encountered: