question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error reading test.stories.mdx with Storybook Docs

See original GitHub issue

I am using Storybook 5.2.0-alpha.29, it is loading my storybook with:

loading presets
loading custom addons config
loading custom webpack config (full-control mode)
loading create-react-app config

My .storybook/config.js looks like this:

import {addParameters} from '@storybook/react';
import {create} from '@storybook/theming';
import '!style-loader!css-loader!sass-loader!../src/app.scss';
import {load} from '@storybook/react';
import {DocsPage} from '@storybook/addon-docs/blocks';
addParameters({
docs: DocsPage,
options: {theme: create({sometheme})}
});

load(require.context('../src/stories', true, /\.stories\.tsx?$/), module)
load(require.context('../src/stories', true, /\.stories\.mdx$/), module)

.storybook/presets.js looks like this:

module.exports =["@storybook/addon-docs/react/preset"];

.storybook/webpack.config.js looks like this:


const path = require('path');

module.exports = async({config}) => {
config.module.rules.push({
enforce: "pre",
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
loader: "eslint-loader"
},{
test: /\.(ts|tsx)$/,
loader: "babel-loader",
exclude: /node_modules/,
options: {
presets: ['@babel/preset-react', '@babel/preset-typescript']
}
});
return config
};

then in my src/stories/test.stories.mdx I have the following:

import {Story, Meta} from '@storybook/addon-docs/blocks';
<Meta title="NewStory" />
<Story name="NewStory123">
<h2> Hello </h2>
</Story>

I am using React, TypeScript and @storybook@5.2.0-alpha.29

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
shilmancommented, Jul 18, 2019

Hey @rezaabedian Try using the following presets.js setup:

module.exports = [
  {
    name: "@storybook/addon-docs/react/preset",
    options: {
      configureJSX: true
    }
  }
];

Does that work for you?

0reactions
stale[bot]commented, Sep 7, 2019

Hey there, it’s me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Read more comments on GitHub >

github_iconTop Results From Across the Web

MDX - Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
How to make a stories.mdx file in Storybook? - Stack Overflow
Try to do it this way: import { Story, Meta, Canvas } from "@storybook/components"; import Text from "."; <Meta title="MDX/Text" ...
Read more >
Interaction tests • Chromatic docs
Go to your published Storybook to reproduce the exact state of your story when the test failed. Click the “View Storybook” button on...
Read more >
Visual Testing with Storybook | Gatsby
Read more about it in the official documentation. TypeScript Support. Storybook v6 has out-of-the-box support for TypeScript. Your components and stories can be ......
Read more >
@storybook/addon-docs - npm
MDX. If you want more control, MDX allows you to write long-form markdown documentation and stories in one file. You can also use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found