trullock / NUglify

NUglify is a HTML, JavaScript and CSS minification Library for .NET (fork of AjaxMin + new features)
Other
398 stars 80 forks source link

Function call deleted after uglify #244

Closed Nintai closed 3 years ago

Nintai commented 3 years ago

I recently upgraded the tinymce library im using to 5.7.1 and now Nuglify seems to create a problem with the javascript file it generates.

I was able to find the exact line that causes the problem: In tinymce.js

each$a(format.attributes, function (value, name) {
          var valueOut;
          value = replaceVars(value, vars); //<- This line
          if (isNumber(name)) {
            name = value;
            compareNode = null;
          }

This is minifed in tinymce.min.js (the e=of(e,o)): Rh(r.attributes,function(e,t){var n;if(e=of(e,o),O(t)&&(t=e,i=null),....

The result of this in the javascript file i generate with NUglify: cft(t.attributes,function(n,i){var r;if(n=,ws(i)&&(i=n,u=null),.... the part in question is n=, which causes an error upon executing the javascript in the browser.

trullock commented 3 years ago

How are you invoking NUglify? What minification switches are you providing?

trullock commented 3 years ago

And are you on the latest NUglify?

Nintai commented 3 years ago
                var minificationResult = Uglify.Js(response.Content,
                                                   new CodeSettings
                                                       {
                                                           MinifyCode = true,
                                                           OutputMode = OutputMode.SingleLine,
                                                           StripDebugStatements = true,
                                                           ReorderScopeDeclarations = false,
                                                           StrictMode = false,
                                                           TermSemicolons = true,
                                                           PreserveImportantComments = false,
                                                           KnownGlobalNamesList = "tinymce"
                                                       });

I updated to 1.13.8 to test if its fixed, still the same problem.

trullock commented 3 years ago

Are there any errors on minificationResult?

trullock commented 3 years ago

Will look further at this later, just the code youve posted is incomplete and doesnt cause the errors you describe. If you can edit the test ive made here and make it fail I'll take a look:

https://github.com/trullock/NUglify/compare/bug_244

Nintai commented 3 years ago

After much more testing i can say this: It seems to be the same error that is already fixed with https://github.com/trullock/NUglify/issues/241

I did upgrade the Nuget Package to 1.13.8, but it seems i had some issue with cache that prevented it from being generated correctly. Now after all that testing i managed to get it to work with 1.13.8 so i guess.... not a bug, just stupidy by me.

Sorry to waste your time like that and thanks for your immediate attention.

trullock commented 3 years ago

No problem, glad you're sorted :)