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

MDX error: Support for the experimental syntax 'jsx' isn't currently enabled #11439

Closed
shilman opened this issue Jul 7, 2020 · 3 comments
Closed

Comments

@shilman
Copy link
Member

shilman commented Jul 7, 2020

A recent change in babel has broken Storybook's MDX configuration in CRA, with the error: Support for the experimental syntax 'jsx' isn't currently enabled.

More info here: #11422 (comment)

This is reproducible in a fresh CRA install, and the problem is present on both next and latest branches, unrelated to any code changes on our side.

cc @tooppaaa @ndelangen

@shilman
Copy link
Member Author

shilman commented Jul 7, 2020

There are two workarounds for this issue. For React projects (e.g. CRA) that have the following line in their main.js:

module.exports = {
  addons: [
    '@storybook/addon-docs'
  ]
};

Update to:

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

If you use <>blah</> style fragments in your MDX, this will unlock a second bug (presumably from the same underlying source): transform-react-jsx: pragma has been set but pragmaFrag has not been set.

For now, the workaround is to rewrite those fragments as <React.Fragment>blah</React.Fragment>.

We're working on:

  1. A better workaround for the fragment issue
  2. A proper fix to both issues

@shilman
Copy link
Member Author

shilman commented Jul 7, 2020

Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-beta.45 containing PR #11448 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Jul 7, 2020
barrymcgee added a commit to barrymcgee/react-components that referenced this issue Jul 16, 2020
This is to fix this error, introduced by Babel: storybookjs/storybook#11439 (comment)
barrymcgee added a commit to barrymcgee/react-components that referenced this issue Jul 16, 2020
This is to fix this error, introduced by Babel: storybookjs/storybook#11439 (comment)
barrymcgee added a commit to canonical/react-components that referenced this issue Jul 16, 2020
This is to fix this error, introduced by Babel: storybookjs/storybook#11439 (comment)
@shilman
Copy link
Member Author

shilman commented Aug 26, 2020

Yay!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.20 containing PR #11448 that references this issue. Upgrade today to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant