Skip to content

Commit

Permalink
fix: make it webpack compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
qasimgulzar committed Aug 13, 2024
1 parent 6a68eb7 commit 682a6be
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"use strict"

function SearchEngine(engine = "meilisearch", config = undefined, indexUid) {

const engines = {
Expand Down Expand Up @@ -74,4 +73,14 @@ SearchEngine.prototype.request = function (url, method, body) {
}
xhr.send(body);
});
}
// Export for CommonJS, AMD, and Global scope
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = SearchEngine;
} else if (typeof define === 'function' && define.amd) {
define([], function () {
return SearchEngine;
});
} else {
window.SearchEngine = SearchEngine;
}

0 comments on commit 682a6be

Please sign in to comment.