storybook: Module parse failed - Babel loader issue?

Getting an error when running with this .storybook/config.js:

import { configure } from '@kadira/storybook'

function loadStories() {
  require('../src/SomeComponent')
}

configure(loadStories, module)

Error:

ERROR in ./.storybook/config.js
Module parse failed: ***/.storybook/config.js Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import { configure } from '@kadira/storybook'
|
| function loadStories() {

Seems like babel is not transpiling or it clashes with some config in my package?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

yes my solution was:

webpack.config.js

const path = require('path');

module.exports = {
    module: {
        rules: [
            {
                test: /.jsx?$/,
                loader: 'babel-loader',
                query: {
                    presets: ['es2015', 'react']
                }
            }, {
                test: /\.scss$/,
                loaders: ["style-loader", "css-loader", "sass-loader"],
                include: path.resolve(__dirname, '../')
            }
        ]
    }
}