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
fix(babel-preset-gatsby-package): remove explicit @babel/plugin-proposal-class-properties
and let @babel/preset-env
add it
#24640
Conversation
loose: true
We have
---edit read description more carefully - ok, makes sense that |
Looks like they use a round-about way to define what plugins the preset pulls:
So it appears as though
Yeah, I'm not really sure about that either. If it cannot be |
So, with
Seems like the assignment is a little more thorough using In
Here it means the difference between the class accessing private methods with the normal property access methods, or by using |
I found this post - https://2ality.com/2015/12/babel6-loose-mode.html helpful when checking on
I'm not exactly sure if it does (at least with our config) - I was trying this out with some monkey patching in babel (logging |
I think when my plugin is installed it might be winding up with a newer version of
|
But if I don't do any upgrade, then it works fine. I totally understand if you don't want to take a chance with this right now. I can also adjust the options of |
We recently bumped
We do need to address it in some way, with our recent |
I feel we should exclude the transforms from babel-preset-env so we use ours and not the one from preset-env, this would remove any issues we will have in the future. I'm currently already doing it for the core-js refactor I'm doing |
After trying it again from scratch after chat with @wardpeet it seems like my previous comment is wrong. I can't really reproduce problem I had anymore and I also don't exactly remember errors I was seeing :S |
Lol - sorry for back and forth - I figured out how I was getting those errors before - it was before #24432 (bump for
But this is not happening after the bump - so I think we can go ahead with your suggestion to remove explicit ---edited:
(it auto adds class-properties) So I guess my confusion was mostly related to some changes happening to babel packages before and after the |
I'm not sure exactly why it's throwing an error on mine; it's the same message, though. The major difference is that mine is doing runtime transpiling through
I just want to verify: you want to remove |
Ops, sorry for spreading confusion here - I didn't realize @wardpeet left comments on the PR that didn't align with my suggestion :P. As mentioned in previous comments - I did chat with him about this PR / issue with
this was couple of minutes after Ward's comment in the PR now that I check times (CEST in my chat logs) - so I think we should be ok with letting TBH, I don't have any issue with doing this other way around - keeping explicit |
Okay, I went ahead and removed |
That results in this error:
|
I think that's because this branch was branched of master before we bumped I just merged master in here to validate my assumption |
@babel/plugin-proposal-class-properties
and let @babel/preset-env
add it
Ok, so merging master in fixed the problem. I'm good with the PR as it is right now - I just want to make sure this also fixes original problem described in |
I monkey patched Versions being used:
Question: should |
I think so yes. |
Done |
Will do one last master merge and get this merged and published |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Js-Brecht!
Published in |
thanks! |
Fixes loose mode issues with Babel gatsbyjs/gatsby#24640 babel/babel#11622
…osal-class-properties` and let `@babel/preset-env` add it (gatsbyjs#24640) * fix error from babel about `loose: true` * update snapshots for tests * remove @babel/plugin-proposal-class-properties * update jest snapshots * remove class-properties from dependencies Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
Description
A constraint was added to
@babel/preset-env
recently, which is causingbabel-preset-gatsby-package
to throw the error shown here: Js-Brecht/gatsby-plugin-ts-config#11. (I usebabel-preset-gatsby-package
for transpiling TSgatsby-*
files fromgatsby-plugin-ts-config
).Apparently, if
loose: true
is set for@babel/plugin-proposal-private-methods
, then it must also be set totrue
for@babel/plugin-proposal-class-properties
. According to this comment, both@babel/plugin-proposal-private-methods
and@babel/plugin-proposal-class-properties
are included by@babel/preset-env
whenshippedProposals: true
, and they're assigned uniform options then. However,babel-preset-gatsby-package
imports@babel/plugin-proposal-class-properties
itself, which overrides that option.To fix it, I've just added
loose: true
to@babel/plugin-proposal-class-properties
so that it matches@babel/preset-env
. Since@babel/preset-env
imports those plugins itself, maybe@babel/plugin-proposal-class-properties
could just be removed from the list?