Syntax Error in Easy Affiliate Links Plugin After JS Optimization
-
We are using the Easy Affiliate Links plugin on our site, and when we run the JS optimization with Autoptimize, it causes a syntax error in the
easy-affiliate-links/dist/public.jsfile.The problematic code is as follows:
// Search for a '' parameter in the query string
var reParamSearch = /([?&])=[^&]*/
if (reParamSearch.test(this.url)) {After optimization, it appears as follows, causing the
ifstatement to be recognized as a regular expression flag:Uncaught SyntaxError: Invalid regular expression flags
if(this.method==='GET'||this.method==='HEAD'){if(options.cache==='no-store'||options.cache==='no-cache'){var reParamSearch=/([?&])=[^&]*/if(reParamSearch.test(this.url)){this.url=this.url.replace(reParamSearch,'$1='+new Date().getTime())}else{var reQueryString=/?/this.url+=(reQueryString.test(this.url)?'&':'?')+'_='+new Date().getTime()}}}}It is unclear whether the issue lies with the JavaScript in Easy Affiliate Links or with the optimization process in Autoptimize. Is it possible for Autoptimize to address this issue?
The topic ‘Syntax Error in Easy Affiliate Links Plugin After JS Optimization’ is closed to new replies.