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" warning for @babel/plugin-proposal-private-property-in-object #415

Open
bendemboski opened this issue Sep 21, 2021 · 5 comments
Open

Comments

@bendemboski
Copy link

Running an app or addon with what is currently the latest ember-cli-babel and @babel/preset-env ([email protected] and @babel/[email protected]) 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?

@SergeAstapov
Copy link
Contributor

Seem like #428 (landed in v7.26.10) was sort of related (although didn't fix presence of this warning)

@rwjblue
Copy link
Member

rwjblue commented Dec 17, 2021

Hmmm, why didn't #428 fix the warning?

@chriskrycho
Copy link
Contributor

#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

@rwjblue
Copy link
Member

rwjblue commented Dec 22, 2021

Ya, makes sense @chriskrycho. I think based on your summary, that we could fix this warning too (without a massive refactoring in logic)?

@chriskrycho
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants