Storybook: Storybook with babel 7.0.0-beta.51

Created on 25 Jun 2018  路  4Comments  路  Source: storybookjs/storybook

Bug or support request summary

I am trying to use storybook with babel 7 but the build always fails with the following message:

ERR! Failed to build the storybook
ERR! ./.storybook/addons.js
ERR! Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /project/node_modules/babel-preset-stage-0/lib/index.js
ERR!     at createDescriptor (/project/node_modules/@babel/core/lib/config/config-descriptors.js:138:11)
ERR!     at items.map (/project/node_modules/@babel/core/lib/config/config-descriptors.js:69:50)
ERR!     at Array.map (<anonymous>)
ERR!     at createDescriptors (/project/node_modules/@babel/core/lib/config/config-descriptors.js:69:29)
ERR!     at createPresetDescriptors (/project/node_modules/@babel/core/lib/config/config-descriptors.js:61:10)
ERR!     at passPerPreset (/project/node_modules/@babel/core/lib/config/config-descriptors.js:53:96)
ERR!     at cachedFunction (/project/node_modules/@babel/core/lib/config/caching.js:32:19)
ERR!     at presets.presets (/project/node_modules/@babel/core/lib/config/config-descriptors.js:25:84)
ERR!     at mergeChainOpts (/project/node_modules/@babel/core/lib/config/config-chain.js:304:26)
ERR!     at /project/node_modules/@babel/core/lib/config/config-chain.js:267:7
ERR!     at buildRootChain (/project/node_modules/@babel/core/lib/config/config-chain.js:64:29)
ERR!     at loadPrivatePartialConfig (/project/node_modules/@babel/core/lib/config/partial.js:55:55)
ERR!     at loadFullConfig (/project/node_modules/@babel/core/lib/config/full.js:43:39)
ERR!     at transformSync (/project/node_modules/@babel/core/lib/transform.js:41:38)
ERR!     at Object.transform (/project/node_modules/@babel/core/lib/transform.js:22:38)
ERR!     at transpile (/project/node_modules/@storybook/react/node_modules/babel-loader/lib/index.js:50:20)
ERR!  @ multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./.storybook/addons.js ./node_modules/@storybook/core/dist/client/manager/index.js
ERR! ./.storybook/config.js
ERR! Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /project/node_modules/babel-preset-stage-0/lib/index.js
ERR!     at createDescriptor (/project/node_modules/@babel/core/lib/config/config-descriptors.js:138:11)
ERR!     at items.map (/project/node_modules/@babel/core/lib/config/config-descriptors.js:69:50)
ERR!     at Array.map (<anonymous>)
ERR!     at createDescriptors (/project/node_modules/@babel/core/lib/config/config-descriptors.js:69:29)
ERR!     at createPresetDescriptors (/project/node_modules/@babel/core/lib/config/config-descriptors.js:61:10)
ERR!     at passPerPreset (/project/node_modules/@babel/core/lib/config/config-descriptors.js:53:96)
ERR!     at cachedFunction (/project/node_modules/@babel/core/lib/config/caching.js:32:19)
ERR!     at presets.presets (/project/node_modules/@babel/core/lib/config/config-descriptors.js:25:84)
ERR!     at mergeChainOpts (/project/node_modules/@babel/core/lib/config/config-chain.js:304:26)
ERR!     at /project/node_modules/@babel/core/lib/config/config-chain.js:267:7
ERR!     at buildRootChain (/project/node_modules/@babel/core/lib/config/config-chain.js:64:29)
ERR!     at loadPrivatePartialConfig (/project/node_modules/@babel/core/lib/config/partial.js:55:55)
ERR!     at loadFullConfig (/project/node_modules/@babel/core/lib/config/full.js:43:39)
ERR!     at transformSync (/project/node_modules/@babel/core/lib/transform.js:41:38)
ERR!     at Object.transform (/project/node_modules/@babel/core/lib/transform.js:22:38)
ERR!     at transpile (/project/node_modules/@storybook/react/node_modules/babel-loader/lib/index.js:50:20)
ERR!  @ multi ./node_modules/@storybook/react/dist/server/config/polyfills.js ./node_modules/@storybook/react/dist/server/config/globals.js ./.storybook/config.js

I found several issues about the integration with babel 7 but none of them helped me with this problem.

Steps to reproduce

Simply run start-storybook or build-storybook with the set of dependencies specified bellow and with the following babel.config.js:

module.exports = {
    plugins: [
        '@babel/plugin-syntax-dynamic-import',
    ],
    presets: [
        '@babel/preset-flow',
        '@babel/preset-env',
        '@babel/preset-react',
    ],
};

Please specify which version of Storybook and optionally any affected addons that you're running

  • @storybook/addon-actions 3.4.7
  • @storybook/addon-knobs 3.4.7
  • @storybook/addon-options 3.4.7
  • @storybook/addons 3.4.7
  • @storybook/react 3.4.7
  • @babel/core 7.0.0-beta.51
  • babel-core 7.0.0-0

Affected platforms

  • Node 8 and 10
babel / webpack compatibility with other tools inactive question / support

Most helpful comment

Hey @timefordroids and @bensampaio, thanks for your reports. Compatibility with babel 7 is currently being worked on (see https://github.com/storybooks/storybook/pull/3746)

All 4 comments

As I know babel 7 is not supported yet. I got the same issue with storybook 4.0.0-alpha.10.

Hey @timefordroids and @bensampaio, thanks for your reports. Compatibility with babel 7 is currently being worked on (see https://github.com/storybooks/storybook/pull/3746)

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!

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!

Was this page helpful?
0 / 5 - 0 ratings