Storybook: Storybook v4 addons break storybook v5

Created on 18 Feb 2019  ·  7Comments  ·  Source: storybookjs/storybook

UPDATE
Seems related to https://github.com/storybooks/storybook/issues/4525


Describe the bug
"@storybook/react": "^4.1.12" causes storybook not being able to run with the current CRA2 project causing Uncaught TypeError: Object(...) is not a function.

✅ Below is a dependency list that worked for the ongoing project and a clean CRA2 app if addons are not registered:

    "@storybook/addon-actions": "^4.1.12",
    "@storybook/addon-knobs": "^4.1.12",
    "@storybook/addon-links": "^4.1.12",
    "@storybook/addon-options": "^4.1.12",
    "@storybook/addons": "^4.1.12",
    "@storybook/react": "^5.0.0-rc.1", // <--- below version 5, storybook would throw the issue above

❌ Issue occurred after registering addons:

// .storybook/addons.js
import '@storybook/addon-knobs/register' // <--- any v4 addon fails the build

Result

  • With an ongoing CRA2 build, I get this: Uncaught TypeError: Object(...) is not a function
  • With a fresh CRA2 app, I get this: TypeError: _addons.default.getElements is not a function and other errors

To Reproduce
Steps to reproduce the behavior:

  1. Create CRA2 app
  2. Install dev dependencies as posted above
  3. Launch storybook
  4. Observe 👀

Screenshots

  • For ongoing CRA2 project:
    screenshot 2019-02-18 at 12 17 07
// vendors-main:1624
var Styled = Object(_emotion_core__WEBPACK_IMPORTED_MODULE_2__["withCSSContext"])(function (props, context) { // <--- failing part
  // ...
}
addons question / support

All 7 comments

@Rolandisimo v4 addons are not intended to be used with v5 -- that's why we're releasing this as 5.0.0 and not 4.2.0 (see https://semver.org/). Is there a reason you don't want to upgrade the addons as well?

@shilman I actually honestly searched for add-ons v5 but couldn't find them. Which made me suspicious, of course.

Could you provide a link possibly to a v5 release of addons?

Thanks!

Found it https://github.com/storybooks/storybook/tree/next/addons
Now everything works like a charm on v5. ✅

Thanks @shilman
Sorry for bothering

No worries, good luck!

Hello! 👋 I'm getting this issue as well but with all my packages being on 4.1.12. I can't upgrade to v5 just yet as we're using [email protected] and [email protected]

Screen Shot 2019-04-23 at 5 16 54 PM

Screen Shot 2019-04-23 at 5 17 11 PM

Is there a way I could get it to work without having to upgrade my React to v16?

Thanks!

@pnarielwala-tc can you open a separate issue? SB5 should work with React v15

@pnarielwala-tc Hey! Did you solve or open that issue? I am getting the same error.

Using 4.1.18 for all storybook packages and 16.8.6 for react and react-dom.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexanbj picture alexanbj  ·  3Comments

rpersaud picture rpersaud  ·  3Comments

xogeny picture xogeny  ·  3Comments

wahengchang picture wahengchang  ·  3Comments

dnlsandiego picture dnlsandiego  ·  3Comments