Bug: Preloaded Javascript does not run in Safari - Mac, iPhone or iPad

I have preloaded JS in Advanced as well as the app's Scripts and Style.

None of it runs from Safari on Mac iDevices.

I tried adding window. to my functions and that did not work. There are no bugs in the functions as they work just fine in Chrome. I also tried a very simple function that just returns its input value in case there was a JS version incompatibility.

So I am back to something with Retool as the source of the issue.

Bumping this as it is very important to one of my clients - people are opening apps on iDevices whether we want them to or not.

Got it figured out.

When there is any preloaded javascript that is not compatible with Safari, all preloaded JS will fail to work.

I had this function in my Advanced tab (app wide preloaded JS):

window.replaceURLsClean = function(t) {
  const isValidHttpUrl = s => {
    let u
    try {u = new URL(s)}
    catch (_) {return false}
    return u.protocol.startsWith("http")
  }
  const m = t.match(/(?<=\s|^)[a-zA-Z0-9-:/]+\.[a-zA-Z0-9-].+?(?=[.,;:?!-]?(?:\s|$))/g)
  if (!m) return t
  const a = []
  m.forEach(x => {
    const [t1, ...t2] = t.split(x)
    a.push(t1)
    t = t2.join(x)
    const y = (!(x.match(/:\/\//)) ? 'https://' : '') + x
    if (isNaN(x) && isValidHttpUrl(y)) 
      a.push('<a href="' + y + '" target="_blank">' + y.split('/')[2] + '</a>')
    else
      a.push(x)
  })
  a.push(t)
  return a.join('')
}

This includes a Regex Lookbehind syntax (?<=) which Safari does not know how to handle.