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

Babel 7.13 compiler assumptions #350

Closed
hyperknot opened this issue Dec 8, 2021 · 8 comments
Closed

Babel 7.13 compiler assumptions #350

hyperknot opened this issue Dec 8, 2021 · 8 comments
Assignees

Comments

@hyperknot
Copy link

Hi, will it be possible to use the Babel 7.13 compiler assumptions with an assumptions key?
https://babeljs.io/docs/en/assumptions

For example MobX docs say the following:

{
    "plugins": [["@babel/plugin-proposal-class-properties", { "loose": false }]],
    // Babel >= 7.13.0 (https://babeljs.io/docs/en/assumptions)
    "assumptions": {
        "setPublicClassFields": false
    }
}

It'd be nice to use this syntax in CRACO.

@DronDima
Copy link

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.

@hyperknot
Copy link
Author

@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 }],
    ]
  },
}

@hyperknot
Copy link
Author

OK, the new CRA 5.x actually ships Babel 7.16, so we'd need these assumptions. Has anyone managed to get this right?

@stale
Copy link

stale bot commented Apr 30, 2022

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.

@stale stale bot added the wontfix label Apr 30, 2022
@hyperknot
Copy link
Author

hyperknot commented May 1, 2022 via email

@stale stale bot removed the wontfix label May 1, 2022
@dilanx dilanx moved this to To Do in CRACO Tasks Jun 29, 2022
@dilanx dilanx self-assigned this Jul 10, 2022
@dilanx
Copy link
Owner

dilanx commented Oct 2, 2022

@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!

@dilanx dilanx moved this from To Do to Ready for Testing in CRACO Tasks Oct 2, 2022
@hyperknot
Copy link
Author

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 [email protected] which I won't start debugging, but the CRACO part seems to be working.

@dilanx
Copy link
Owner

dilanx commented Oct 10, 2022

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.

@dilanx dilanx closed this as completed Oct 10, 2022
Repository owner moved this from Ready for Testing to Done in CRACO Tasks Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants