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

Webpack not transpiling JSX for custom addons #5122

Closed
travikk opened this issue Dec 30, 2018 · 3 comments
Closed

Webpack not transpiling JSX for custom addons #5122

travikk opened this issue Dec 30, 2018 · 3 comments
Labels

Comments

@travikk
Copy link

travikk commented Dec 30, 2018

Describe the bug
In my project, I'm trying to add a custom storybook addon to provide extra capabilities for my stories.
I'm using CRA 2 + Storybook.

When I create a simple addon registrar, the app fails to start with the following error.

register.jsx:

addons.register('Controls', api => {
    addons.addPanel('Controls/panel', {
        title: 'UI Test',
        render: props => <span>Hi</span>
    });
});

Error I get in Chrome console:

Uncaught Error: Module parse failed: Unexpected token (28:25)
You may need an appropriate loader to handle this file type.
|     addons.addPanel('Controls/panel', {
|         title: 'UI Test',
>         render: props => <span>Hi</span>
|     });
| });
    at Object../src/__stories__/addons/controls/register.jsx (main.2aaaee8f95f5a00a5172.bundle.js:28)
    at __webpack_require__ (runtime~main.7b4918090cfe19b7778a.bundle.js:79)
    at Module../.storybook/addons.js (main.2aaaee8f95f5a00a5172.bundle.js:14)
    at __webpack_require__ (runtime~main.7b4918090cfe19b7778a.bundle.js:79)
    at Object.0 (main.2aaaee8f95f5a00a5172.bundle.js:39)
    at __webpack_require__ (runtime~main.7b4918090cfe19b7778a.bundle.js:79)
    at checkDeferredModules (runtime~main.7b4918090cfe19b7778a.bundle.js:46)
    at Array.webpackJsonpCallback [as push] (runtime~main.7b4918090cfe19b7778a.bundle.js:33)
    at main.2aaaee8f95f5a00a5172.bundle.js:1

Additionally, I'm extending the storybook webpack config to allow TS. Nothing fancy.

Any idea why is this not getting transpiled by default?

@slipo
Copy link

slipo commented Jan 11, 2019

Perhaps it's related to #4995

I downgraded to 4.0.12 and everything works for me now. Before that I couldn't use any sort of custom addon. Seems like an urgent issue. Took me a while to figure out it wasn't a mistake on my part.

@stale
Copy link

stale bot commented Feb 7, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Feb 7, 2019
@stale
Copy link

stale bot commented Mar 9, 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!

@stale stale bot closed this as completed Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants