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

loose option warning while building after 6.2.9 upgrade #14805

Closed
RyanHavoc opened this issue May 4, 2021 · 38 comments
Closed

loose option warning while building after 6.2.9 upgrade #14805

RyanHavoc opened this issue May 4, 2021 · 38 comments

Comments

@RyanHavoc
Copy link

Describe the bug
We're upgrading from @storybook/vue 6.1.21 to 6.2.9 an we're now seeing the following error during Storybook start:

Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-methods.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
	["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
to the "plugins" section of your Babel config.

This warning was shown multiple times during the build and then eventually I'd get an error and the build would fail.

We have a .bashrc file so I updated it to this:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": "ie 11, last 2 versions",
        "useBuiltIns": "usage",
        "corejs": 3,
        "loose": true,
        "shippedProposals": true
      }
    ]
  ],
  "env": {
    "test": {
      "presets": [
        [
          "@babel/preset-env",
          {
            "targets": {
              "node": "current"
            }
          }
        ],
        "@vue/babel-preset-jsx"
      ],
      "plugins": ["dynamic-import-node"]
    }
  },
  "plugins": [
    "@babel/plugin-syntax-dynamic-import", 
    ["@babel/plugin-proposal-class-properties", { "loose": true }],
    ["@babel/plugin-proposal-private-methods", { "loose": true }],
    ["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
  ]
}

This has helped somewhat but we still get the error, however Storybook does start.

image

To Reproduce

All I did to see these issues was npx sb@latest upgrade and after starting storybook again I see the warnings.

System

Environment Info:

  System:
    OS: macOS 11.3
    CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/Code/snyk/registry/frontend/node_modules/.bin/npm
  Browsers:
    Chrome: 90.0.4430.93
    Firefox: 82.0.2
    Safari: 14.1
  npmPackages:
    @storybook/addon-a11y: ^6.2.9 => 6.2.9
    @storybook/addon-actions: ^6.2.9 => 6.2.9
    @storybook/addon-backgrounds: ^6.2.9 => 6.2.9
    @storybook/addon-docs: ^6.2.9 => 6.2.9
    @storybook/addon-queryparams: ^6.2.9 => 6.2.9
    @storybook/addon-storysource: ^6.2.9 => 6.2.9
    @storybook/preset-typescript: ^3.0.0 => 3.0.0
    @storybook/source-loader: ^6.2.9 => 6.2.9
    @storybook/vue: ^6.2.9 => 6.2.9
@fapspirit
Copy link

fapspirit commented May 4, 2021

Had the same warning on the fresh install of storybook.

I tried to add this plugin in babel field inside .storybook/main.js, but the warnings didn't disappear.

However, warnings went away when I manually added [require.resolve("@babel/plugin-proposal-private-property-in-object"), { "loose": true }] inside my node_modules in this file:

I suppose this should be in the default Babel config, or I missing something?

@RyanHavoc
Copy link
Author

Interesting... It would be great if we could find an official solution to this without needing to fork and fix in this way.

@robcaldecott
Copy link

I tried manually installing the @babel/plugin-proposal-private-property-in-object plugin and updated my babel config but it makes no difference. But Storybook will start albeit with lots of these warnings as it builds.

@RyanHavoc
Copy link
Author

That's what I see too. Would be good to get rid of the warnings. 😕

@gregorybolkenstijn
Copy link

Updating to the latest @babel/core at 7.14.0, deleting the node_modules folder, deleting and rebuilding yarn.lock also does not remove the warning.

@trouba
Copy link

trouba commented May 5, 2021

Adding plugins: ['@babel/plugin-proposal-private-property-in-object', { loose: true }], in main.js removed the warning for me:

addons: [{
    name: '@storybook/addon-docs',
    options: {
        babelOptions: {
            plugins: [
                ['@babel/plugin-proposal-private-property-in-object', {
                    loose: true
                }],
            ],
        },
    },
}, ],

Read also: babel/babel#11622

@RyanHavoc
Copy link
Author

Unfortunately making that same change for me didn't make any difference.

@trouba
Copy link

trouba commented May 5, 2021

@RyanHavoc Sorry, did you try adding in in .storybook/main.js and not in your .bashrc ?

@RyanHavoc
Copy link
Author

Yes, I tried adding those to my babel config in main.js and also like this:

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

But no joy.

@RyanHavoc
Copy link
Author

Possibly there's something different with Vue instance. This same setup don't remove the warning for me.

@samydoesit
Copy link

Same here, none of the solutions above do work in our setup.

After Upgrading to latest pre release we do also get a lot of these warnings "Field 'browser' doesn't contain a valid alias configuration".

Storybook doesn't start.
Does someone know whats going on?

@dontsave
Copy link

dontsave commented May 6, 2021

We are seeing this issue in 6.2.9 when building the manager with Webpack 5. None of the above workarounds eliminate the warns for us.

@danantal
Copy link

We are also seeing this issue and none of the workarounds works for us either. (6.2.9)
Any resolution / workaround here? It is quite a bit annoying due to the amount of output that it spams in the console when building a large project.

@RyanHavoc
Copy link
Author

I've found that adding:

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

To our .bablerc file reduces the amount of warning spam to a couple of repetitions, but doesn't make it go away entirely.

@jaykay-p
Copy link

jaykay-p commented May 10, 2021

I tried all above workarounds, but none worked.

What worked for me was downgrading @babel/preset-env to ~7.13.0.
The loose warning happened not when I upgraded storybook to 6.2.9, but when @babel/preset-env was upgraded to ^7.14.0

@erykpiast
Copy link

Same here. Tried everything above with no success. Downgrade to @babel/[email protected] didn't help either. I'm out of ideas at the moment, to be honest, sticking to Storybook 6.1 for now :(

@danantal
Copy link

@kuk941025 Thanks, indeed, it does fix the issue for us as well.

@erykpiast Initially, we also tried downgrading the @babel/preset-env to no avail, but that was actually due to it being installed in multiple versions by different packages. Maybe you are in the same situation. You can try to run yarn why @babel/preset-env or npm ls @babel/preset-env to actually check which versions are installed - and if you are on yarn you can use package json resolutions to force the version.

@erykpiast
Copy link

You're right @danantal, I have multiple versions indeed and Storybook is still using 7.14! Thank you for this idea! :D

I'm not using Yarn, but uninstalling Storybook packages via NPM and installing them again did the trick. Poor-man resolution forcing in action 🙃

eseliger added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this issue May 17, 2021
This revealed storybookjs/storybook#14805, not sure if we want to merge it with these warnings in the log
eseliger added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this issue May 18, 2021
* Unpin and upgrade babel to latest version

Depends on sourcegraph/babel-plugin-transform-react-hot-loader-wrapper#110

* Update plugin to unbreak build

This revealed storybookjs/storybook#14805, not sure if we want to merge it with these warnings in the log
@shilman shilman closed this as completed May 27, 2021
@pixelass
Copy link

After testing I can confirm that the new beta mentioned in #14805 (comment) removes the warnings.

@lifeiscontent
Copy link
Member

@shilman I can't seem to use the latest @next version to fix this issue.

@shilman
Copy link
Member

shilman commented Jun 2, 2021

@lifeiscontent meaning upgrading doesn't solve it for you?

@lifeiscontent
Copy link
Member

@shilman I'm not sure, I think there might be some code outside of this issue preventing me from using it. When I upgraded I couldn't get storybook to run with the latest package pinned to @next

@shilman
Copy link
Member

shilman commented Jun 6, 2021

@lifeiscontent Do you have a repro I can look at?

eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 8, 2021
eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 8, 2021
eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 8, 2021
eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 8, 2021
eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 8, 2021
eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 8, 2021
eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 8, 2021
eins78 added a commit to leihs/leihs-ui that referenced this issue Jun 9, 2021
@pybuche
Copy link

pybuche commented Jun 29, 2021

@shilman I also still have the problem, even after trying all the solutions above. I'm on 6.3.1 and come from 6.2.5.

  • I've tried to add @babel/plugin-proposal-private-property-in-object plugin everywhere (in addons, in babelrc with loose mode enabled)
  • I've tried to install it as a dev dependency
    Nothing worked so far, always the same message
stack trace
Error: /Users/pybuche/Work/Alan/alan-web/node_modules/acorn-jsx/index.js: 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled).
 at enableFeature (/Users/pybuche/Work/Alan/alan-web/node_modules/@babel/helper-create-class-features-plugin/lib/features.js:50:13)
 at PluginPass.pre (/Users/pybuche/Work/Alan/alan-web/node_modules/@babel/helper-create-class-features-plugin/lib/index.js:74:35)
 at transformFile (/Users/pybuche/Work/Alan/alan-web/node_modules/@storybook/core-common/node_modules/@babel/core/lib/transformation/index.js:96:27)
 at transformFile.next (<anonymous>)
 at run (/Users/pybuche/Work/Alan/alan-web/node_modules/@storybook/core-common/node_modules/@babel/core/lib/transformation/index.js:35:12)
 at run.next (<anonymous>)
 at Function.transform (/Users/pybuche/Work/Alan/alan-web/node_modules/@storybook/core-common/node_modules/@babel/core/lib/transform.js:19:41)
 at transform.next (<anonymous>)
 at step (/Users/pybuche/Work/Alan/alan-web/node_modules/gensync/index.js:261:32)
 at /Users/pybuche/Work/Alan/alan-web/node_modules/gensync/index.js:273:13
 at async.call.result.err.err (/Users/pybuche/Work/Alan/alan-web/node_modules/gensync/index.js:223:11)
 at /Users/pybuche/Work/Alan/alan-web/node_modules/gensync/index.js:189:28
 at /Users/pybuche/Work/Alan/alan-web/node_modules/@storybook/core-common/node_modules/@babel/core/lib/gensync-utils/async.js:62:7
 at /Users/pybuche/Work/Alan/alan-web/node_modules/gensync/index.js:113:33
 at step (/Users/pybuche/Work/Alan/alan-web/node_modules/gensync/index.js:287:14)
 at /Users/pybuche/Work/Alan/alan-web/node_modules/gensync/index.js:273:13
 at /Users/pybuche/Work/Alan/alan-web/node_modules/@storybook/builder-webpack4/node_modules/webpack/lib/NormalModule.js:316:20
 at /Users/pybuche/Work/Alan/alan-web/node_modules/loader-runner/lib/LoaderRunner.js:367:11
 at /Users/pybuche/Work/Alan/alan-web/node_modules/loader-runner/lib/LoaderRunner.js:233:18
 at context.callback (/Users/pybuche/Work/Alan/alan-web/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
 at /Users/pybuche/Work/Alan/alan-web/node_modules/@storybook/core-common/node_modules/babel-loader/lib/index.js:59:103

.storybook/.babelrc.js

const rootConfig = require("../babel.config");

/**
 * Take the project config, but set loose to true for class properties and private methods for Storybook.
 *
 * As Storybook updates, it's probably worth trying to delete this file and seeing if it will run without
 * the workaround.
 */
const patchedPlugins = rootConfig.plugins.map((plugin) => {
  if (
    [
      "@babel/plugin-proposal-class-properties",
      "@babel/plugin-proposal-private-methods",
    ].includes(plugin)
  ) {
    return [plugin, { loose: true }];
  }
  return plugin;
});

// Add flow to transpile some dependencies

module.exports = {
  ...rootConfig,
  plugins: patchedPlugins.concat(
    "@babel/plugin-transform-flow-strip-types"
  ),
};

.storybook/main.js

module.exports = {
  stories: [
    "../shared/**/*.stories.mdx",
    "../shared/**/*.stories.@(js|jsx|ts|tsx)",
  ],
  addons: [
    "@storybook/addon-docs",
    "@storybook/addon-essentials",
    "storybook-addon-designs"
  ],
};

@thien-do
Copy link

@pybuche hi, can you try yarn why with the mentioned packages? (@babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object)

It's to see if there's any duplication in the dependencies.

@pybuche
Copy link

pybuche commented Jul 5, 2021

@thien-do Sorry for the late answer. Here are the yarn why for the 3 packages

@babel/plugin-proposal-class-properties
yarn why @babel/plugin-proposal-class-properties                        1 ✘  2m 0s  alan-backend-EXv2AJIq   14:45:57
yarn why v1.19.0
[1/4] 🤔  Why do we have the module "@babel/plugin-proposal-class-properties"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@babel/[email protected]"
info Has been hoisted to "@babel/plugin-proposal-class-properties"
info Reasons this module exists
 - "workspace-aggregator-4c874e11-8e56-4aae-91e8-687e36e95c94" depends on it
 - Specified in "dependencies"
 - Hoisted from "_project_#@babel#plugin-proposal-class-properties"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "116KB"
info Disk size with transitive dependencies: "6.01MB"
info Number of shared dependencies: 30
=> Found "metro-react-native-babel-preset#@babel/[email protected]"
info This module exists because "_project_#metro-react-native-babel-preset" depends on it.
info Disk size without dependencies: "320KB"
info Disk size with unique dependencies: "416KB"
info Disk size with transitive dependencies: "6.3MB"
info Number of shared dependencies: 30
=> Found "@babel/preset-env#@babel/[email protected]"
info This module exists because "_project_#@babel#preset-env" depends on it.
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "116KB"
info Disk size with transitive dependencies: "6.01MB"
info Number of shared dependencies: 30
=> Found "@storybook/builder-webpack4#@babel/[email protected]"
info Reasons this module exists
 - "_project_#@storybook#builder-webpack4" depends on it
 - Hoisted from "_project_#@storybook#builder-webpack4#@babel#preset-env#@babel#plugin-proposal-class-properties"
info Disk size without dependencies: "408KB"
info Disk size with unique dependencies: "504KB"
info Disk size with transitive dependencies: "6.39MB"
info Number of shared dependencies: 30
=> Found "@storybook/core-common#@babel/[email protected]"
info Reasons this module exists
 - "_project_#@storybook#core-common" depends on it
 - Hoisted from "_project_#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-class-properties"
info Disk size without dependencies: "408KB"
info Disk size with unique dependencies: "504KB"
info Disk size with transitive dependencies: "6.39MB"
info Number of shared dependencies: 30
=> Found "next#@babel/[email protected]"
info This module exists because "_project_#murray#next" depends on it.
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "116KB"
info Disk size with transitive dependencies: "6.01MB"
info Number of shared dependencies: 30
=> Found "metro-babel-register#@babel/[email protected]"
info This module exists because "_project_#react-native#metro-babel-register" depends on it.
info Disk size without dependencies: "408KB"
info Disk size with unique dependencies: "504KB"
info Disk size with transitive dependencies: "6.39MB"
info Number of shared dependencies: 30
=> Found "jscodeshift#@babel/[email protected]"
info This module exists because "_project_#alan-codemods#jscodeshift" depends on it.
info Disk size without dependencies: "408KB"
info Disk size with unique dependencies: "504KB"
info Disk size with transitive dependencies: "6.39MB"
info Number of shared dependencies: 30
=> Found "@storybook/addon-docs#@babel/[email protected]"
info Reasons this module exists
 - "_project_#@storybook#addon-docs#@babel#preset-env" depends on it
 - Hoisted from "_project_#@storybook#addon-docs#@babel#preset-env#@babel#plugin-proposal-class-properties"
info Disk size without dependencies: "408KB"
info Disk size with unique dependencies: "504KB"
info Disk size with transitive dependencies: "6.39MB"
info Number of shared dependencies: 30
=> Found "babel-preset-fbjs#@babel/[email protected]"
info This module exists because "_project_#react-native#fbjs-scripts#babel-preset-fbjs" depends on it.
=> Found "next#@babel/preset-env#@babel/[email protected]"
info This module exists because "_project_#murray#next#@babel#preset-env" depends on it.
info Disk size without dependencies: "320KB"
info Disk size with unique dependencies: "416KB"
info Disk size with transitive dependencies: "6.3MB"
info Number of shared dependencies: 30
=> Found "murray#@babel/[email protected]"
info Reasons this module exists
 - "_project_#murray#@storybook#react#@storybook#core-common" depends on it
 - Hoisted from "_project_#murray#@storybook#react#@storybook#core-common#@babel#plugin-proposal-class-properties"
 - Hoisted from "_project_#murray#@storybook#react#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-class-properties"
 - Hoisted from "_project_#murray#@storybook#react#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#@babel#plugin-proposal-class-properties"
=> Found "fr-mobile-free#@babel/[email protected]"
info Reasons this module exists
 - "_project_#fr-mobile-free#@storybook#react#@storybook#core-common" depends on it
 - Hoisted from "_project_#fr-mobile-free#@storybook#react#@storybook#core-common#@babel#plugin-proposal-class-properties"
 - Hoisted from "_project_#fr-mobile-free#@storybook#react#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-class-properties"
 - Hoisted from "_project_#fr-mobile-free#@storybook#react#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#@babel#plugin-proposal-class-properties"
=> Found "murray-mobile#@babel/[email protected]"
info Reasons this module exists
 - "_project_#murray-mobile#@storybook#react#@storybook#core-common" depends on it
 - Hoisted from "_project_#murray-mobile#@storybook#react#@storybook#core-common#@babel#plugin-proposal-class-properties"
 - Hoisted from "_project_#murray-mobile#@storybook#react#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-class-properties"
 - Hoisted from "_project_#murray-mobile#@storybook#react#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#@babel#plugin-proposal-class-properties"
=> Found "@storybook/csf-tools#@babel/[email protected]"
info Reasons this module exists
 - "_project_#@storybook#addon-docs#@storybook#csf-tools#@babel#preset-env" depends on it
 - Hoisted from "_project_#@storybook#addon-docs#@storybook#csf-tools#@babel#preset-env#@babel#plugin-proposal-class-properties"
info Disk size without dependencies: "2.21MB"
info Disk size with unique dependencies: "2.3MB"
info Disk size with transitive dependencies: "8.2MB"
info Number of shared dependencies: 30
=> Found "metro#@babel/[email protected]"
info Reasons this module exists
 - "_project_#fr-mobile#@react-native-community#cli#metro#metro-babel-register" depends on it
 - Hoisted from "_project_#fr-mobile#@react-native-community#cli#metro#metro-babel-register#@babel#plugin-proposal-class-properties"
 - Hoisted from "_project_#fr-mobile#@react-native-community#cli#metro#metro-react-native-babel-preset#@babel#plugin-proposal-class-properties"
info Disk size without dependencies: "496KB"
info Disk size with unique dependencies: "592KB"
info Disk size with transitive dependencies: "6.47MB"
info Number of shared dependencies: 30
=> Found "@react-native-community/cli#@babel/[email protected]"
info Reasons this module exists
 - "_project_#fr-mobile#@react-native-community#cli#metro-react-native-babel-transformer#metro-react-native-babel-preset" depends on it
 - Hoisted from "_project_#fr-mobile#@react-native-community#cli#metro-react-native-babel-transformer#metro-react-native-babel-preset#@babel#plugin-proposal-class-properties"
✨  Done in 3.26s.
@babel/plugin-proposal-private-methods
yarn why @babel/plugin-proposal-private-methods                              ✔  4s  alan-backend-EXv2AJIq   14:46:08
yarn why v1.19.0
[1/4] 🤔  Why do we have the module "@babel/plugin-proposal-private-methods"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@babel/[email protected]"
info Reasons this module exists
- "_project_#@babel#preset-env" depends on it
- Hoisted from "_project_#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#@storybook#builder-webpack4#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#@storybook#core-common#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#@storybook#builder-webpack4#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#@storybook#addon-docs#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#murray#next#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#murray#@storybook#react#@storybook#core-common#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#fr-mobile-free#@storybook#react#@storybook#core-common#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#murray-mobile#@storybook#react#@storybook#core-common#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#@storybook#addon-docs#@storybook#csf-tools#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#murray#@storybook#react#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#fr-mobile-free#@storybook#react#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#murray-mobile#@storybook#react#@storybook#core-common#@babel#preset-env#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#murray#@storybook#react#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#fr-mobile-free#@storybook#react#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#@babel#plugin-proposal-private-methods"
- Hoisted from "_project_#murray-mobile#@storybook#react#@storybook#core#@storybook#core-server#@storybook#builder-webpack4#@babel#plugin-proposal-private-methods"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "116KB"
info Disk size with transitive dependencies: "6.01MB"
info Number of shared dependencies: 30
✨  Done in 2.75s.
@babel/plugin-proposal-private-property-in-object
yarn why @babel/plugin-proposal-private-property-in-object                      1 ✘  alan-backend-EXv2AJIq   14:47:55
yarn why v1.19.0
[1/4] 🤔  Why do we have the module "@babel/plugin-proposal-private-property-in-object"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
error We couldn't find a match!
✨  Done in 2.60s.

This is the result just after launching npx sb upgrade. Looks like @babel/plugin-proposal-private-property-in-object doesn't exist in my current dependencies.
Looking at the results, seems like we have version conflicts with @babel/plugin-proposal-class-properties. Do you know how we could fix that? Using peerDependencies maybe?

@vivshaw
Copy link

vivshaw commented Jul 29, 2021

@pybuche I ran into this exact issue, and discovered that editing my main Babel config (not my storybook/.babelrc, but the whole project's .babelrc) fixed the problem. This leads me to believe that somehow acorn-jsx was using my main .babelrc instead of the one that Storybook was uising. So, you might try setting loose: true for all these Babel plugins and/or preset-env in your main .babelrc and see if that does anything for you.

Sadly I cannot repro this on a clean repo, and it's on a closed-source project, so I can't provide a good example. 😢

@pybuche
Copy link

pybuche commented Jul 31, 2021

@vivshaw thanks for the tip!
I finally managed to solve the problem with yarn v2's resolutions config to fix the right versions for Babel plugins and it works like a charm!

@davidcalhoun
Copy link

davidcalhoun commented Oct 29, 2021

Getting this error again when upgrading @babel/preset-env from 7.15.0 to 7.15.8

@existe-deja
Copy link

adding

plugins: [
    ['@babel/plugin-proposal-private-methods', { loose: true }],
    ['@babel/plugin-proposal-private-property-in-object', { loose: true }]
  ]

to my babel.config.js removed the warnings for [email protected]

wmfgerrit pushed a commit to wikimedia/mediawiki-extensions that referenced this issue Nov 15, 2022
* Update Wikibase from branch 'master'
  to 3cab92be81ee1e8d511ae4529233aeaf72875950
  - Merge "bridge: update storybook"
  - bridge: update storybook
    
    In particular, this fixes all those '"loose" option' warnings that were
    littering our logs. See also storybookjs/storybook#14805
    
    Change-Id: Ie0eab21be94fcc1b519c8e8534a3695ae5c58e1b
wmfgerrit pushed a commit to wikimedia/mediawiki-extensions-Wikibase that referenced this issue Nov 15, 2022
In particular, this fixes all those '"loose" option' warnings that were
littering our logs. See also storybookjs/storybook#14805

Change-Id: Ie0eab21be94fcc1b519c8e8534a3695ae5c58e1b
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