anseki / plain-draggable

The simple and high performance library to allow HTML/SVG element to be dragged.
https://anseki.github.io/plain-draggable/
MIT License
773 stars 99 forks source link

Updated File which can cause issues after minification. #28

Closed mahad-apex closed 5 years ago

mahad-apex commented 5 years ago

I used this file in my project and I was minifying all my JS (by the handler, generically) but this file used "default" keyword which is reserved keyword. So, in YUI JS minifier due to 'default' reserved keyword, it was breaking. In code, there are several places where .default is used. these are examples: function () { return t.default } function () { lt = document.body, re() }, !0); e.default = ee

anseki commented 5 years ago

Hi @mahad-apex, thank you for your PR. Sorry, I couldn't understand this PR. Why you replace the minified file? That is, the replacing is meaningless because the file is minified by building. And your file seems too big wastefully. Also, the default is already reserved keyword by ECMAScript, and the code was added by Webpack. What is problem in YUI JS minifier?

mahad-apex commented 5 years ago

YUI JS minifier actually breaks when 'new' and 'default' used as variable. So in my case i changed 2 stances of .default to ["default"] in my PR.

anseki commented 5 years ago
mahad-apex commented 5 years ago

Dear Anseki, your pluggin is great and we used in our application. Find these lines in your minified version.

function () { return t.default }
function () { lt = document.body, re() }, !0); e.default = ee

The .default written in these lines can cause issues in minification.

Your point is absolutely right, there is no further need of minification of minified file, you can close PR! In my case, there is a handler in C# we read generically all Js files either third party plugins or our functional JS and minify it once before dumping in page via handler, we dont use Githubissues.

  • Githubissues is a development platform for aggregating issues.