styleguidist/react-styleguidist

Error when importing component in Markdown file

Open

#1.345 geöffnet am 26. Apr. 2019

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (1.416 Forks)github user discovery
bughelp wanted

Repository-Metriken

Stars
 (11.091 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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

Contributor Guide