Skip to content

Styleguide failing after build. #74

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

Closed
jamieholliday opened this issue Jan 21, 2016 · 7 comments
Closed

Styleguide failing after build. #74

jamieholliday opened this issue Jan 21, 2016 · 7 comments
Labels

Comments

@jamieholliday
Copy link

Styleguide is working fine on dev server but fails after build with this error:

Uncaught Error: Cannot detect component name for .../src/components/Column/Column.js

I have done a little poking around and the array of components that are the argument to setComponentsNames() in src/utils/utils.js look like this when running build (in Chrome Devtools):

{
examples: Array[1]
filepath: " .../src/components/Column/Column.js"
module: function (props)
pathLine: "components/Column/Column.js"
props: Object
}

but are like this when running the dev server:

{
examples: Array[1]
filepath: ".../src/components/Column/Column.js"
module: function Column(props)
name: "Column"
pathLine: "components/Column/Column.js"
props: Object
}

So as far as I can tell the function that is module and the name property are a bit different and thats whats causing the error. Not sure how to fix this though

@sapegin
Copy link
Member

sapegin commented Jan 21, 2016

Can you share some code that I can debug?

@mik01aj
Copy link
Collaborator

mik01aj commented Jan 21, 2016

Maybe it's because you have .../ instead of ../.

@jamieholliday
Copy link
Author

I added the .../ so as not to write out the full path to the files in the example above. Sorry if its a bit confusing. The filepath is actually the correct full path to the file.

@sapegin - I've made a test case in this repo:
https://github.com/jamieholliday/react-styleguidist-testcase
It only includes one component called <Test />
This will demonstrate the error. I was thinking maybe was something to do with webpack. I did have to add a workaround in package.json script to get it to work in the first place with my current setup:

"styleguide": "BABEL_ENV=styleguidist styleguidist server",

@svenheden
Copy link

I just ran into the same error, haven't had time to debug it yet though.

@mik01aj
Copy link
Collaborator

mik01aj commented Jan 28, 2016

You can try specifying the displayName explicitly. If it will help, that's some valuable input. (See also #63)

@jamieholliday
Copy link
Author

Explicitly adding displayName appears to fix the issue

@sapegin sapegin added the bug label Feb 8, 2016
@sapegin sapegin closed this as completed in 736ccab Feb 8, 2016
@sapegin
Copy link
Member

sapegin commented Feb 8, 2016

Please try 2.0.0-rc3.

@sapegin sapegin mentioned this issue Feb 19, 2016
Closed
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants