Skip to content

Unable to Use Decorators with Default Create-React-App Config #495

@ambroselittle

Description

@ambroselittle

Steps:

  1. Follow guide here: https://react-styleguidist.js.org/docs/getting-started.html
  2. Install something that uses decorators (e.g., mobx/mobx-react).
  3. Add a testComponent that uses a decorator to /src/components
  4. Run

Repro Repo:
https://github.com/ambroselittle/styleguidist-test

Error I am seeing when running (npm run styleguide) on latest macOS:

Failed to compile.

Error in ./src/components/testComponent.jsx
Syntax error: Unexpected token (4:0)

  2 | import {observer} from 'mobx-react';
  3 | 
> 4 | @observer
    | ^
  5 | export default class TestComponent extends Component {
  6 |     render() {
  7 |         return (

 @ ./~/react-styleguidist/loaders/styleguide-loader.js!./~/react-styleguidist/lib/index.js 25:30-129
 @ ./~/react-styleguidist/lib/index.js
 @ multi ./~/react-styleguidist/lib/index ./~/react-styleguidist/~/react-dev-utils/webpackHotDevClient.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions