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

Unable to minify js file if class contains method named import or export #403

Open
mrzewnicki opened this issue Aug 2, 2024 · 1 comment

Comments

@mrzewnicki
Copy link

Hi,

Problem occurs during minification of js file from external library. We are aware the import and export words are reserved keyword but we aren't able to change it in every new version of library files.

Code to reproduce:

var result = Uglify.Js(@"class bug {
    export() { console.log('omg'); }
    import() { console.log('omg'); }
}");
Console.WriteLine(result.HasErrors);
Console.WriteLine(result.Code);
Console.WriteLine(string.Join(", ", result.Errors.Select(e => e.Message)));
Console.ReadLine();

Result:

True
class bug{export(){console.log("omg")}import(){console.log("omg")}}
Expected identifier: export, Expected identifier: import
@trullock
Copy link
Owner

trullock commented Aug 4, 2024

Looks like it doesnt support overwriding the export and import keywords. should be a simple fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants