• Resolved windorz

    (@windorz)


    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.js file.

    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 if statement 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?

Viewing 1 replies (of 1 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    The problem is a missing semi-colon after the var reParamSearch line.

    I would simply exclude the file from optimization, that’s what exclusions are for ??

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.