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

Minified JS broken with private class identifiers #15

Closed
PLUS-RobertEhrenleitner opened this issue Nov 24, 2022 · 4 comments
Closed

Minified JS broken with private class identifiers #15

PLUS-RobertEhrenleitner opened this issue Nov 24, 2022 · 4 comments

Comments

@PLUS-RobertEhrenleitner
Copy link
Contributor

PLUS-RobertEhrenleitner commented Nov 24, 2022

I report this here once more after posting it on autoptimize.

When a class contains private attributes or methods, the necessary line break or semicolon is not inserted.
As a minimum non-working example, the following class in valid JavaScript syntax does not work:

class TestClass {
    #a = 3
    #b = 5
    #fnc1() {
        do_something()
    }
    #fnc(2) {
        do_anything()
    }
}

It is minified to:

class TestClass{#a=3#b=5#fnc1(){do_something()}#fnc(2){do_anything()}}

which contains several syntax errors: There should be line breaks or semicolons between all the attributes and methods.

Assumption: The hash sign is treated the same way like an operator, and lines beginning with an operator can be appended to the preceding line.

@PLUS-RobertEhrenleitner
Copy link
Contributor Author

PLUS-RobertEhrenleitner commented Dec 7, 2022

See pull request #18.

@PLUS-RobertEhrenleitner
Copy link
Contributor Author

I added a test case.

@glensc
Copy link
Collaborator

glensc commented Dec 13, 2022

forgot to check PR uses issue close patterns

closing manually

@glensc glensc closed this as completed Dec 13, 2022
@glensc
Copy link
Collaborator

glensc commented Dec 13, 2022

thanks. released as 2.4.3

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

2 participants