16

This is a bug report for Stack Exchange frontend code (sstatic.net); don't close it as off-topic!

Script error: Missing polyfill for replaceAll

On older browsers, the site is broken. I can't click on any button. There is no String.prototype.replaceAll:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#browser_compatibility

There is an error on this script here:

https://cdn.sstatic.net/Js/stub.en.js?v=17e20b4b4731

Uncaught TypeError: l.replaceAll is not a function
    at a (stub.en.js?v=17e20b4b4731:formatted:55)
    at full.en.js?v=3708f79bf934:formatted:2365
    at Object.266 (full.en.js?v=3708f79bf934:formatted:2493)
    at __webpack_require__ (full.en.js?v=3708f79bf934:formatted:11524)
    at a (full.en.js?v=3708f79bf934:formatted:138)
    at e (full.en.js?v=3708f79bf934:formatted:11676)
    at full.en.js?v=3708f79bf934:formatted:11684
    at full.en.js?v=3708f79bf934:formatted:11726
    at full.en.js?v=3708f79bf934:formatted:11728

babel-plugin-polyfill-corejs3@0.2.5 needs to be updated. See String.prototype.replaceAll not polyfilled #13701:

https://github.com/babel/babel/issues/13701#issuecomment-925119447

11
  • 1
    Probably related to this: JavaScript no longer works all of a sudden | We're Migrating our JavaScript
    – hkotsubo
    Dec 14 '21 at 0:59
  • @hkotsubo Yea, it's probably because of that site JS update.
    – XP1
    Dec 14 '21 at 1:05
  • 2
    I can confirm that adding a replaceAll polyfill fixes the website. It's a simple fix. No other script errors. Works in old browsers again.
    – XP1
    Dec 14 '21 at 1:38
  • @XP1, how does one add such a PolyFill? From the console? Dec 14 '21 at 12:47
  • 1
    I'm on it. Thanks!
    – Benjamin Hodgson StaffMod
    Dec 14 '21 at 16:36
  • 3
    Just deployed a fix, should be sorted now. Let me know if you continue to have problems.
    – Benjamin Hodgson StaffMod
    Dec 14 '21 at 17:22
  • @Gerard H. Pille, I noticed something was wrong (couldn't vote) a few days ago, but I was too lazy to investigate. I assumed a major website would have this fixed before I would. :S Adding the polyfill in the console wouldn't work unless it was done before the script loads. It would have to be a user script or extension that loads before the script. However, what I did differently was intercept the HTTPS traffic and inject my own modified JS file instead of using the server's JS file. I used Fiddler web debugging proxy, so all browsers will receive my modified JS. No need console or extension.
    – XP1
    Dec 14 '21 at 20:31
  • @Benjamin Hodgson, thanks, currently typing in my old browser. :)
    – XP1
    Dec 14 '21 at 20:32
  • @XP1 if you use Chrome, it can be as simple as adding a local override in the meantime too Dec 14 '21 at 21:29

You must log in to answer this question.

Browse other questions tagged .