Closed
Description
How to reproduce
Bootstrap a new app w/ create-react-app
npm install -g create-react-app
create-react-app teststyleguidist
cd teststyleguidist
Follow the getting started guide to add styleguidist :
package.json
{
"name": "teststyleguidist",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-scripts": "1.0.10"
},
"scripts": {
"styleguide": "styleguidist server",
"styleguide:build": "styleguidist build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"react-styleguidist": "^5.5.1"
}
}
src/components/Button/index.js
import React from "react";
import PropTypes from "prop-types";
/**
* General component description in JSDoc format. Markdown is *supported*.
*/
export default class Button extends React.Component {
static propTypes = {
/** Description of prop "foo". */
foo: PropTypes.number,
/** Description of prop "baz". */
baz: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
};
static defaultProps = {
foo: 42
};
render() {
return <button>Hello</button>;
}
}
src/components/Button/Readme.md
React component example:
<Button size="large">Push Me</Button>
Expected Behavior
Running yarn run styleguide
launches the styleguidist dev server
Actual Behavior
❯❯❯ yarn run styleguide
yarn run v0.19.1
$ styleguidist server
Style guide server started at:
http://0.0.0.0:6060
Cannot load ./src/components/Button/index.js: you may need an appropriate webpack loader to handle this file type.
Learn how to configure your style guide:
https://react-styleguidist.js.org/docs/webpack.html
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.