Closed iJoris closed 2 years ago
Found out that the problem was Optional chaining.
Do I understand correctly that the error occurs in bundled and minified files?
If so, which minimizer do you use? NUglify or WebMarkupMin? Do you use ES6 module bundling?
@adams85 Yes, I use WebMarkupMin. I've tested it with the ES6 package Karambolo.AspNetCore.Bundling.EcmaScript. But no luck.
For now, I've just removed the '?' with simple if statements.
Karambolo.AspNetCore.Bundling.EcmaScript is for bundling JavaScript modules. If you doesn't use JavaScript modules, there's no point in consuming this package.
It seems likely that WebMarkupMin doesn't handle the optional chaining operator well. However, you can try NUglify instead of that. If that doesn't work either, you can even try to add a direct reference to the latest version (1.17.10) of the NUglify package to your project because the latest release of Karambolo.AspNetCore.Bundling.NUglify references a bit outdated version (1.16.0) of NUglify. (Since a direct reference would force the latest version to be used.)
Karambolo.AspNetCore.Bundling.EcmaScript is for bundling JavaScript modules. If you doesn't use JavaScript modules, there's no point in consuming this package.
It seems likely that WebMarkupMin doesn't handle the optional chaining operator well. However, you can try NUglify instead of that. If that doesn't work either, you can even try to add a direct reference to the latest version (1.17.10) of the NUglify package to your project because the latest release of Karambolo.AspNetCore.Bundling.NUglify references a bit outdated version (1.16.0) of NUglify. (Since a direct reference would force the latest version to be used.)
Cheers, going to try that! Thanks for the quick replies.
Getting multiple errors from sentry on syntax errors after bundeling. Just tested on iPhone 11 pro 13.2, and the not-bundeled JS works perfectly, but after bundeling gives a syntax error.
Code:
target.forEach((el)=>{ if (el.name.includes(',')) { const arr=el.name.split(','); arr.forEach((str)=>{ const sec=window.data.find(x=>x.name=== str); if (sec) { result.push(sec.id); } } ); } else { result.push(el.id); } } ); result.forEach((id)=>{ dowork(id); } ); }