Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Run Error - Module build failed: SyntaxError: Unexpected token (8:4) #958

Closed
stolinski opened this issue Apr 24, 2017 · 2 comments
Closed

Comments

@stolinski
Copy link

I followed the setup instructions exactly and received this on first run.

ERROR in ./.stories/index.js
Module build failed: SyntaxError: Unexpected token (8:4)

   6 | storiesOf('Welcome', module)
   7 |   .add('to Storybook', () => (
>  8 |     <Welcome showApp={linkTo('Button')}/>
     |     ^
   9 |   ));
  10 |
  11 | storiesOf('Button', module)

 @ ./.storybook/config.js 4:2-24
@stolinski
Copy link
Author

Had to change my babelrc to look like this.

{
  "presets": ["es2015", "es2016", "stage-0", "react"],
  "plugins": [
    "transform-object-rest-spread",
    "transform-decorators-legacy",
    "transform-class-properties",
    "babel-root-slash-import"
  ]
}

This should really be in the docs

@andyford
Copy link

I also ran into this issue while using storybook with create-react-app and styled-components. Based on @stolinski's babelrc comment, what worked for me was changing my babelrc from:

{
    "plugins": [
        "babel-plugin-styled-components",
    ]
}

to

{
    "presets": [
        "react"
    ],
    "plugins": [
        "babel-plugin-styled-components",
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants