Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch multi-select-dropdown-js@1.0.3 for the project I'm working on.
The issue is that MultiSelect.js declares the class without exporting it, which makes it impossible to use in native ESM environments (browser without bundler, or bundlers like Rollup/Vite) without relying on window.MultiSelect as a side effect, which doesn't work in ESM module scope.
Adding export default MultiSelect; or export { MultiSelect }; at the end of the file would make the library usable as a proper ES module while keeping full backward compatibility with the existing auto-init behavior (document.querySelectorAll('[data-multi-select]')...).
Here is the diff that solved my problem:
diff --git a/node_modules/multi-select-dropdown-js/MultiSelect.js b/node_modules/multi-select-dropdown-js/MultiSelect.js
index 390ac78..cbf79d2 100644
--- a/node_modules/multi-select-dropdown-js/MultiSelect.js
+++ b/node_modules/multi-select-dropdown-js/MultiSelect.js
@@ -672,3 +672,4 @@ class MultiSelect {
}
document.querySelectorAll('[data-multi-select]').forEach(select => new MultiSelect(select));
+export default MultiSelect;
This issue body was partially generated by patch-package.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
multi-select-dropdown-js@1.0.3for the project I'm working on.The issue is that
MultiSelect.jsdeclares the class without exporting it, which makes it impossible to use in native ESM environments (browser without bundler, or bundlers like Rollup/Vite) without relying onwindow.MultiSelectas a side effect, which doesn't work in ESM module scope.Adding
export default MultiSelect;orexport { MultiSelect };at the end of the file would make the library usable as a proper ES module while keeping full backward compatibility with the existing auto-init behavior (document.querySelectorAll('[data-multi-select]')...).Here is the diff that solved my problem:
This issue body was partially generated by patch-package.