Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer the assignment of matchSorter.rankings #147

Closed
mochaaP opened this issue Jan 15, 2024 · 2 comments · Fixed by #148
Closed

Defer the assignment of matchSorter.rankings #147

mochaaP opened this issue Jan 15, 2024 · 2 comments · Fixed by #148
Labels

Comments

@mochaaP
Copy link
Contributor

mochaaP commented Jan 15, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Rollup got confused here and rewrote matchSorter to an anonymous function assigning to a variable, making an ReferenceError.

Here is the diff that solved my problem:

diff --git a/node_modules/match-sorter/dist/match-sorter.esm.js b/node_modules/match-sorter/dist/match-sorter.esm.js
index 19a6b97..6dffe8c 100644
--- a/node_modules/match-sorter/dist/match-sorter.esm.js
+++ b/node_modules/match-sorter/dist/match-sorter.esm.js
@@ -11,7 +11,6 @@ var rankings = {
   MATCHES: 1,
   NO_MATCH: 0
 };
-matchSorter.rankings = rankings;
 var defaultBaseSortFn = function defaultBaseSortFn(a, b) {
   return String(a.rankedValue).localeCompare(String(b.rankedValue));
 };
@@ -58,6 +57,7 @@ function matchSorter(items, value, options) {
     return matches;
   }
 }
+matchSorter.rankings = rankings;
 
 /**
  * Gets the highest ranking for value for the given item based on its values for the given keys

This issue body was partially generated by patch-package.

@kentcdodds
Copy link
Owner

That change is fine for me. Could you make a PR?

Copy link

🎉 This issue has been resolved in version 6.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants