Uglify-js errors on MDB.JS


Topic: Uglify-js errors on MDB.JS

Grf free asked 3 years ago

Hi,

I run uglify-js on my system and up till MDB-Pro version 4.7.4 this ran fine. After updating to mdb-pro version 4.8.2 a couple of weeks ago, I get the following error;

Parse error at mdb.js:18245,142 ight m-2 fas fa-".concat($nativeSelectChild.data('fas'), " ").concat([...this.op ^ ERROR: Unexpected token: punc «.» at JS_Parse_Error.get (eval at (/usr/local/lib/node_modules/uglify-js/tools/node.js:20:1), :71:23) at fatal (/usr/local/lib/node_modules/uglify-js/bin/uglifyjs:298:27) at run (/usr/local/lib/node_modules/uglify-js/bin/uglifyjs:241:9) at Object. (/usr/local/lib/node_modules/uglify-js/bin/uglifyjs:167:5) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)

As you can see, it errors.

I did some digging and found that the three dots ... is causing the error because it seems not to be JavaScript (ECMAScript 5). Removing the three dots solves the error, however I can't oversee the impact of removing these ...

Lines 18245-18247 from mdb.js

 var fas = $nativeSelectChild.data('fas') ? "<i class=\"fa-pull-right m-2 fas fa-".concat($nativeSelectChild.data('fas'), " ").concat([...this.options.fasClasses].join(''), "\"></i> ") : '';
 var far = $nativeSelectChild.data('far') ? "<i class=\"fa-pull-right m-2 far fa-".concat($nativeSelectChild.data('far'), " ").concat([...this.options.farClasses].join(''), "\"></i> ") : '';
 var fab = $nativeSelectChild.data('fab') ? "<i class=\"fa-pull-right m-2 fab fa-".concat($nativeSelectChild.data('fab'), " ").concat([...this.options.fabClasses].join(''), "\"></i> ") : '';

Is there a way to solve this? I can't get rid of uglify-js because it part of my building tool environment.

Thanks in advance!


Bartłomiej Malanowski staff commented 3 years ago

Could you please point me how to reproduce this issue?


Grf free commented 3 years ago

In order to reproduce, one has to install UglifyJs and add it to the compile process. How this added to the MDB setup, is hard for me to say.

May we can cut a long story short if you can explain the purpose of the three dots in front of ‘this’.


Menno priority commented 2 years ago

Is this issue revolved? We are experiencing the same issues! It breaks our build version (also using uglify-js) on IE11.

Issue seems to be the use of the spread syntax (ES6) > https://codeburst.io/javascript-es6-the-spread-syntax-f5c35525f754

Possible solution: https://www.leereamsnyder.com/blog/new-skool-uniq-in-internet-explorer


MDBootstrap staff commented 2 years ago

Hi Menno,

Right now our MDB material select is under hard refactor. After we publish our new material select this issue will be gone. We are sorry this issue was hanging for so long. If there is anything I can help you with I am here for you.

Best Regards, Piotr


Menno priority commented 2 years ago

Hello Piotr,

Thanks for the reply. Can you give an estimate when the development is finished?

Cheers


Bartłomiej Malanowski staff commented 2 years ago

Currently, we cannot provide you the exact date, but we're working to finish it until November


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.2
  • Device: Mac Book Pro
  • Browser: Firefox Developer
  • OS: OSX
  • Provided sample code: No
  • Provided link: No