question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with custom StyleGuideRenderer

See original GitHub issue

My 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:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stinogacommented, Nov 22, 2016

@sapegin Good call. I was able to repro there and fix the issue. Thanks!

1reaction
sapegincommented, Nov 22, 2016

Sure, Webpack will use path of the real file for loaders, not aliased one.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found