Issue with custom StyleGuideRenderer
See original GitHub issueMy styleguide config is working great, until I try to add a custom renderer. I added the following line to my styleguide.config.js
:
webpackConfig.resolve.alias['rsg-components/StyleGuide/StyleGuideRenderer'] = path.join(__dirname, 'source/styleguide/assets/StyleGuide.jsx');
… and when I build my styleguide, it come us blank with this error in the console:
style-guide.bundle.js:54 Uncaught Error: Cannot find module "rsg-components/StyleGuide/StyleGuideRenderer"
… but this file does exist. This is my source/styleguide/assets/StyleGuide.jsx
file, which is relative to the directory my styleguide.config.js
file lives. Although that shouldn’t matter since I call the file absolutely, and have confirmed that file exists.
import React, { PropTypes } from 'react';
import cx from 'classnames';
const s = require('./StyleGuide.css');
const StyleGuideRenderer = ({ title, homepageUrl, components, toc, sidebar }) => (
<div className={cx(s.root, sidebar && s.hasSidebar)}>
<main className={s.content}>
<div className={s.components}>
{components}
<footer className={s.footer}>
</footer>
</div>
</main>
{ sidebar &&
<div className={s.sidebar}>
<h1 className={s.heading}>{title}</h1>
<h2>tttttt</h2>
{toc}
</div>
}
</div>
);
StyleGuideRenderer.propTypes = {
title: PropTypes.string.isRequired,
homepageUrl: PropTypes.string.isRequired,
components: PropTypes.object.isRequired,
toc: PropTypes.node.isRequired,
sidebar: PropTypes.bool,
};
export default StyleGuideRenderer;
Any ideas?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Default Style Guide - Vue Styleguidist
... header at div at StyleGuideRenderer (webpack://vue-styleguidist-example-vuecli3-custom/./styleguide/components/StyleGuideRenderer.js?:83:23) at _class ...
Read more >styleguidist/styleguidist - Gitter
Problem is, it makes styleguidist break with the following errors: Module not found: Can't resolve 'components/Button' in '~/src/components'
Read more >How can I access react context in react-styleguidist's Wrapper ...
Assuming I'm correct about the context not updating in ThemedWrapper due to it being located outside of StyleGuideRenderer , two high level ...
Read more >Custom fields formatting is not converted to markdown in ... - Jira
Have a project with a text custom field using the Wiki Renderer;; Add some formatting in this field, using wiki markup;; Turn on...
Read more >Top 5 react-styleguidist Code Examples | Snyk
amalto / platform6-ui-components / typescript / custom ... Workaround for issue https://github.com/reactjs/react-docgen/issues/221 // If prop has ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sapegin Good call. I was able to repro there and fix the issue. Thanks!
Sure, Webpack will use path of the real file for loaders, not aliased one.