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

Minify causes syntax error #76

Closed
MichaelXF opened this issue May 17, 2023 · 0 comments
Closed

Minify causes syntax error #76

MichaelXF opened this issue May 17, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@MichaelXF
Copy link
Owner

Describe the bug:

Minify causes syntax error

Config and Small code sample

Config:

{
  target: "node",
  minify: true
}

Code:

var myObject = {
  "`": true,
  "^": true,
  "]": true,
  "[": true
}

Output:

var myObject = {
    `: !0,
    ^: !0,
    ]: !0,
    [: !0
};

export function isValidIdentifier(name: string): boolean {
if (typeof name !== "string") {
return false;
}
if (name.includes(".") || name.includes(" ")) {
return false;
}
var x = name.match(/^[A-z$_][A-z0-9$_]*/);
return x && x[0] == name;
}

The regex includes char codes 65 to 122 which is incorrect. It should use A-Za-z instead.

@MichaelXF MichaelXF added the bug Something isn't working label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant