Using Storybook with MobX and CRA
See original GitHub issueI’m having trouble running Storybook with MobX, i’m using create-react-app with react-app-rewired.
Here’s my babel configuration in package.json
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
]
],
Storybook config .storybook/config.js
import { configure } from '@storybook/react';
configure(require.context('../src', true, /\.stories\.js$/), module);
react-app-rewire configuration config-overrides.js
const {
override,
disableEsLint,
addDecoratorsLegacy,
fixBabelImports,
} = require("customize-cra");
module.exports = override(
disableEsLint(),
addDecoratorsLegacy(),
fixBabelImports("react-app-rewire-mobx", {
libraryDirectory: "",
camel2DashComponentName: false
}),
);
I get the following error when i run yarn run storybook
:
…src\store\KeyframesStore.js: Support for the experimental syntax ‘decorators-legacy’ isn’t currently enabled (6:5):
The app works fine with current config, is there any missing configuration for storybook ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Developers - Using Storybook with MobX and CRA - - Bountysource
I'm having trouble running Storybook with MobX, i'm using create-react-app with react-app-rewired. Here's my babel configuration in package.json
Read more >Wire in data - Storybook Tutorials
To get data into it, we need a “container”. This example uses Redux, the most popular React library for storing data, to build...
Read more >Discussion of How to: mobx-state-tree + react + typescript
This is a walkthrough on how to get a full setup with mobx-state-tree and react in a CRA app with typescript. This guide...
Read more >mobx-book-store-example - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >MobX 6 has been released (decorator free and supports CRA ...
131 votes, 24 comments. 330K subscribers in the reactjs community. A community for learning and developing web applications using React by ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @SaadRegal, I can confirm this work fine with
@storybook/preset-create-react-app
.All I did was add a
main.js
with:I then saw another error, which was related to an import of a non-existent file (a
jpg
). I removed that, and everything worked as expected.Let me know how you go with this 😃
You need to use the standalone preset
@storybook/preset-create-react-app
(if you’re not already) and configure it to usereact-app-rewired
.