Skip to content

Commit

Permalink
Fix vite global patch for browser environments
Browse files Browse the repository at this point in the history
  • Loading branch information
flevi29 committed Jan 17, 2025
1 parent 489b583 commit 80bc464
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ export default defineConfig(({ mode }) => {
// TODO: Remove this in the future ( https://github.com/meilisearch/meilisearch-js/issues/1806 )
{
output: {
footer: `(function(d,_){(d=typeof globalThis!="undefined"?globalThis:d||self,_(d))})(this,function(d){for(var k of Object.keys(d.${globalVarName})){d[k]=d.${globalVarName}[k]}})`,
footer: `(function () {
if (typeof self !== "undefined") {
var clonedGlobal = Object.assign({}, self.${globalVarName});
delete clonedGlobal.default;
Object.assign(self, clonedGlobal);
}
})();`,
},
},
},
Expand Down

0 comments on commit 80bc464

Please sign in to comment.