question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"loose" warning for @babel/plugin-proposal-private-property-in-object

See original GitHub issue

Running an app or addon with what is currently the latest ember-cli-babel and @babel/preset-env (ember-cli-babel@7.26.6 and @babel/preset-env@7.15.6) results in this warning:

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-class-properties.
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.

Should we be adding that option to the config anytime this block runs?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
chriskrychocommented, Dec 17, 2021

#428 fixed a related-but-not-identical issue: the set of class properties plugins themselves must match, and that’s a hard error if they don’t. Here, it’s just warning that we’re forcibly setting it when we configure the plugins, separately from whatever is set in preset-env. Similar-enough that it’s easy to assume they’re the same (I did, and was confused!). I suspect this is just an ordering issue? We get options from preset-env last in getBabelOptions:

https://github.com/babel/ember-cli-babel/blob/e1f0758e0ea4892d69885f0c07561a5de091daf2/lib/get-babel-options.js#L17-L66

0reactions
chriskrychocommented, Dec 22, 2021

I think so? My first-pass though when looking at the code was that we just need to get the preset env config earlier up and pass any relevant options from it—mostly just "loose", I think?—down into the various _add*Plugin(s) calls.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Though the "loose" option was set to "false" in your @babel ...
I'm getting this warning over and over: Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be...
Read more >
babel/plugin-proposal-private-property-in-object
Note: The loose mode configuration setting must be the same as @babel/proposal-class-properties . When true, private property in expressions will check own ...
Read more >
Latest Nuxt v2.15.7 install with babel "loose" option warnings
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- ...
Read more >
Fix warning about babel - web log about tech, and more
WARN Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private- ...
Read more >
loose option warning while building after 6.2.9 upgrade #14805
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 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found