Fix Babel issue when running Storybook.
See original GitHub issueBug Description
A number of engineers have been seeing the following output from Babel in the terminal when attempting to run npm run storybook
or processes that invoke this under the hood (e.g. npm run test:visualtest
):
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. 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.
We should investigate the causes and determine an appropriate fix. It could be that be changing our Babel plugins as suggested in the warning fixes the issue, or perhaps we need to address some sort of dependency version mismatch.
Steps to reproduce
- Using the latest
develop
branch, runnpm run storybook
, and see the output in the terminal. - Removing
node_modules
and re-runningnpm install
did not fix the issue. If you are not seeing the issue, you could try doing this.
Additional Context
- OS: Mac OS Big Sur 11.2
- Node version: v14.15.4 (using NVM)
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- No babel warnings should be output when building Storybook
Implementation Brief
Test Coverage
- N/A
Visual Regression Changes
- No changes expected
QA Brief
- Running the Storybook build should not generate the aforementioned Babel warnings
- Storybook should work as before
Changelog entry
- N/A
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
@wpdarren I think this is likely to be
QA:eng
, but will let Evan or Matt make the call 👍QA ✅
I no longer see all the babels warnings when running storybook 👍