Closed hyperknot closed 2 years ago
Hello, i also have issue with assumptions
. I'm trying to use decorator inside react class component, but babel overrides it. So, from different sources(one, two and others) it looks like i need to add @babel/plugin-proposal-decorators
with legacy: true
. But In official documentation they have note that we need to add setPublicClassFields
assumption in babel config when using legacy: true
.
@DronDima I don't think the assumption is needed as of today, as the current Babel is 7.12 in CRA.
This works for decorators:
module.exports = {
babel: {
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: false }],
]
},
}
OK, the new CRA 5.x actually ships Babel 7.16, so we'd need these assumptions. Has anyone managed to get this right?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not stale
On 2022. May 1., Sun at 0:29, stale[bot] @.***> wrote:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
— Reply to this email directly, view it on GitHub https://github.com/gsoft-inc/craco/issues/350#issuecomment-1114064281, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYVD5RJ7UZPGW53CKA3LDVHWX4DANCNFSM5JTXV4MQ . You are receiving this because you authored the thread.Message ID: @.***>
@hyperknot sorry for such a long delay. I've added this functionality and will release it in alpha 8. I haven't tested it, but if you'd like to ensure that it works for you as you expect once alpha 8 is out, that would be great!
I've done the upgrade to test this. It seems to be working, at least I get a warning message if I add assumptions. There are other errors with react-scripts@5.x which I won't start debugging, but the CRACO part seems to be working.
Thanks @hyperknot. If the craco part seems to be working, I'll close this issue. Feel free to leave a comment if there are any problems.
Hi, will it be possible to use the Babel 7.13 compiler assumptions with an
assumptions
key? https://babeljs.io/docs/en/assumptionsFor example MobX docs say the following:
It'd be nice to use this syntax in CRACO.