styleguidist/react-styleguidist

Error when importing component in Markdown file

Open

#1345 aperta il 26 apr 2019

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)TypeScript (1416 fork)github user discovery
bughelp wanted

Metriche repository

Star
 (11.091 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Current behavior

Hello, I am attempting to import a JSX component into a Markdown documentation file. I'm creating an alias for these styleguide-only view components in my styleguide.config.js:

module.exports = {
  ...  
  webpackConfig: {
    resolve: {
      alias: {
        styleguideComponents: path.resolve(STYLEGUIDE_PATH, './components')
      }
    }
  }
}

console.log'ing the path shows it to be as expected, and when I import a component in my Markdown file, it throws no errors:

```jsx noeditor
import { Do } from 'styleguideComponents';

<Do>
  You should do this thing.
</Do>

Here is the <Do /> component, for reference:

import React from 'react'

const Do = ({ children }) => (
  <div className='Do'>
    { children }
  </div>
)

export default Do

However, when I load the styleguide, I get a red error saying "SyntaxError: Missing initializer in const declaration". I am using the latest react-styleguidist version.

Any advice is much appreciated :)

Guida contributor