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

Add support for public class fields #1228

Closed
tobiu opened this issue Sep 29, 2020 · 1 comment
Closed

Add support for public class fields #1228

tobiu opened this issue Sep 29, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@tobiu
Copy link
Collaborator

tobiu commented Sep 29, 2020

Public class fields are a stage3 proposal for a very long time already:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields

If you look close at the browser support, safari did catch up and this looks reasonable to use at this point. The only exception is Firefox for Android, which we can ignore.

With added support for class fields, we can move all configs without a trailing underscore into the class body directly (e.g. className or ntype).

The only downside is, that webpack is not able to build stage3 proposals:
webpack/webpack#10216

More precisely: the internal parser (Acorn) needs to get adjusted, which is not possible using webpack based configs.

Screenshot 2020-09-29 at 14 22 37

To add support for all (...) stage3 proposals, we could adjust the package.json and add a resolutions prop:
https://github.com/OnurGvnc/acorn-with-stage3

This one only works with yarn. To make it work with npm, we also need to add:
https://github.com/rogeriochaves/npm-force-resolutions

It feels worth a try. In case we get it working for neo, we could probably get rid of the trailing underscore for configs completely (a breaking change).

@tobiu tobiu added the enhancement New feature or request label Sep 29, 2020
@tobiu
Copy link
Collaborator Author

tobiu commented Apr 25, 2021

we can now do this:
webpack/webpack#10216 (comment)

@tobiu tobiu closed this as completed Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant