sinnerwithguts
sinnerwithguts

Reputation: 693

babel conflict running storybook

I've an app built with create-react-app. I've added storybook (in accordance to this manual https://storybook.js.org/docs/guides/guide-react/). When I run yarn storybook, I get this error.

'loose' mode configuration must be the same for both @babel/plugin-proposal-class-properties and @babel/plugin-proposal-private-methods

Not quite sure how to solve it. Any ideas?

Upvotes: 14

Views: 9323

Answers (2)

Luigi04
Luigi04

Reputation: 457

I got it to work with the following in babel.config.js:

plugins: [
    ["@babel/plugin-proposal-class-properties", { loose: true }],
    ["@babel/plugin-proposal-private-methods", { loose: true }],
]

Upvotes: 1

sinnerwithguts
sinnerwithguts

Reputation: 693

Anybody who has the same issue, this is the best solution (from the link provided by yuriy636). Add this to babel config

plugins: [
      '@babel/plugin-proposal-class-properties',
      '@babel/plugin-proposal-private-methods',
    ],

Upvotes: 14

Related Questions