Shims and polyfills

I recently hit x.replaceAll is not a function because String.prototype.replaceAll only exists after Node 15.0.0. The error throwing code is inside a package I depend on. What’s the best solution to solve my problem? Is there some Meteor hook where one could patch the String prototype?

EDIT: I was already importing regenerator-runtime/runtime.js at the top of my server entry point so I added core-js/features/string/replace-all below and it just works!

1 Like