question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

matchAll Polyfill

See original GitHub issue

We’ve been seeing some client side error logs re .matchAll() calls evaluating to undefined. After a bit of digging, we realized that all of those exceptions originate on older-ish browsers. Nonetheless, this is an issue for us (and I suspect others, too). Specifically, the issue stems from this line: https://github.com/dcastil/tailwind-merge/blob/a703309b6811b8b798b1a8cd2d1db3ac06811b36/src/lib/merge-classlist.ts#L83

I’m curious if you’ve given thought to adding a matchAll polyfill, or using a different approach to matching?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
schonfeldcommented, Aug 21, 2022

Confirmed working on latest v1.6.0. Thanks so much, @dcastil !

1reaction
schonfeldcommented, Aug 19, 2022

Right – I’ve impl’d that polyfill and it seems to work for us. But it took us an hour to realize this was the issue. Figured I’d post here to save others some time.

I’m able to reproduce this on Chrome 70.x on Mac. It’s difficult to run multiple Chrome versions on the same machine, but you can download an old build of Chromium and easily run that side-by-side. Here’s the version I’m using: version: 70.0.3538.124

Here’s a sample stacktrace, although, the issue is rather straight forward:

image
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use the string.prototype.matchall polyfill?
I used this, works for me. Looping through the matches of global flagged pattern did the trick. Let me know if you have...
Read more >
A polyfill for the String.prototype.matchAll method ... - GitHub Gist
A polyfill for the String.prototype.matchAll method. Only available in Node12+ and most browsers. - matchAll polyfill.js.
Read more >
string.prototype.matchall - npm
Spec-compliant polyfill for String.prototype.matchAll. Latest version: 4.0.8, last published: a month ago.
Read more >
String.prototype.matchAll() - JavaScript - MDN Web Docs
The matchAll() method returns an iterator of all results matching a string against a regular expression, including capturing groups.
Read more >
polyfill.io URL Builder
String.prototype.matchAll
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found