addDecorator doesn't work on config.js
See original GitHub issueDescribe the bug I am trying to implement some global style. And I think config.js is the good place to put my code. I copied the addDecorator from the official storybook doc to test. But it shows the error:
in ./.storybook/config.js
Module build failed (from ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/ccl/dev/storybook-sandbox/.storybook/config.js: Unexpected token (3:35)
1 | import { configure, addDecorator } from '@storybook/react';
2 |
> 3 | const CenterDecorator = storyFn => <div style={styles}>{storyFn()}</div>;
| ^
4 | addDecorator(CenterDecorator);
I am using the create-react-app and @storybook/react": "^5.1.3
It is a problem with Create-react-app?
The addDecorator works fine on individual components but it does not work on config.js
Issue Analytics
- State:
- Created 4 years ago
- Comments:27 (14 by maintainers)
Top Results From Across the Web
Storybook addDecorator does not work from config.js?
When I was trying to make storybook work with typescript I had to upgrade this package from 3.4.8 version to 4.0.0-alpha.10. Here are...
Read more >storybook-addon-i18n
Create a file called addons.js in your Storybook config, if there is no any and append following line: · Then in your story's...
Read more >storybook-addon-react-docgen - npm
There exist other addons that do this, but they didn't work in the ... Create or add to a file called addons.js in...
Read more >Workaround for using non-declarative configuration in the ...
js , move them to config.js . // preview.js import { addDecorator } from '@storybook/svelte'; import { withA11y } from '@storybook/addon-a11y ...
Read more >Storybook Docs with mdx support and addon knobs - Medium
);addDecorator(storyWrapper);configure(loadStories, module);. Okay, not bad, everything seems to be working after that. Docs addon. Next, I try ...
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
Good news, I think @mrmckeb is going to fix this!
@justinlazaro-iselect Does creating
.storybook/babel.config.js
with the following content work?