styleguidist / react-styleguidist

Isolated React component development environment with a living style guide
https://react-styleguidist.js.org/
MIT License
10.84k stars 1.44k forks source link

VIEW CODE button doesn't work #1057

Closed antonfrolovsky closed 6 years ago

antonfrolovsky commented 6 years ago

When click VIEW CODE

TypeError: __webpack_require__.e is not a function
    in EditorLoader (created by Slot)
    in div (created by Slot)
    in Slot (created by Playground)
    in div (created by PlaygroundRenderer)
    in div (created by PlaygroundRenderer)
    in PlaygroundRenderer (created by Styled(Playground))
    in Styled(Playground) (created by Playground)
    in Playground (created by Examples)
    in article (created by ExamplesRenderer)
    in ExamplesRenderer (created by Styled(Examples))
    in Styled(Examples) (created by Examples)
    in Examples (created by Unknown)
    in div (created by ReactComponentRenderer)
    in ReactComponentRenderer (created by Styled(ReactComponent))
    in Styled(ReactComponent) (created by Unknown)
    in Unknown (created by Components)
    in div (created by ComponentsRenderer)
    in ComponentsRenderer (created by Components)
    in Components (created by Section)
    in section (created by SectionRenderer)
    in SectionRenderer (created by Styled(Section))
    in Styled(Section) (created by Section)
    in Section (created by Sections)
    in section (created by SectionsRenderer)
    in SectionsRenderer (created by Styled(Sections))
    in Styled(Sections) (created by Sections)
    in Sections (created by StyleGuide)
    in main (created by StyleGuideRenderer)
    in div (created by StyleGuideRenderer)
    in StyleGuideRenderer (created by Styled(StyleGuide))
    in Styled(StyleGuide) (created by StyleGuide)
    in StyleGuide
sapegin commented 6 years ago

Works on my machine. Clearly you can't expect more from such a bug report.

antonfrolovsky commented 6 years ago

@sapegin I have ReactRedux project with Emotion All works but not VIEW CODE

index.js

import Button from './Button';
export default Button;

Button.styles.js

import styled from 'react-emotion';

const styles = {};
styles.Button = styled('button')`
  width: 100px;
  height: 30px;
`;

export default styles;

Button.js

import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import s from './Button.style';

class Button extends PureComponent {
  static propTypes = {
    align: PropTypes.string,
  };

  static defaultProps = {
    align: null,
  };

  render() {
    const { children, align, ...buttonProps } = this.props;

    return (
      <s.Button {...buttonProps}>
        {children && typeof children === 'string' ? children : ''}
      </s.Button>
    );
  }
}

export default Button;

styleguidist.config.js

module.exports = {
  title: 'META Components',
  components: './source/components/UIkit/**/[A-Z]*.js',
  ignore: ['**/*.style.js'],
  skipComponentsWithoutExample: true,
};

Maybe this error because of webpack version, i think but not sure.

"webpack": "^4.1.1",
"webpack-cli": "^2.0.11",
"webpack-dev-server": "^3.1.1",

image

sapegin commented 6 years ago

The thing is it works for all other users, so likely something is different in your project. But without a demo I can't say anything. I use Styleguidist with Emotion without any issues.

kamranahmedse commented 6 years ago

Same issue here. Looks like the recent webpack upgrade broke it.