styleguidist/react-styleguidist

Error when importing component in Markdown file

Open

#1 345 ouverte le 26 avr. 2019

Voir sur GitHub
 (4 commentaires) (0 réactions) (0 assignés)TypeScript (1 416 forks)github user discovery
bughelp wanted

Métriques du dépôt

Stars
 (11 091 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

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 :)

Guide contributeur