Skip to content

Commit

Permalink
Add require/exports to worker scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludwig Meysel committed Mar 9, 2023
1 parent aaf2874 commit 4badee1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (!objects) {
objects[id] = blob;
return `blob:http:https://localhost/${id}`;
};
self.URL.revokeObjectURL = (url) => {
self.URL.revokeObjectURL = url => {
let m = String(url).match(/^blob:http:\/\/localhost\/(.+)$/);
if (m) delete objects[m[1]];
};
Expand Down Expand Up @@ -97,6 +97,8 @@ function Worker(url, options) {
},
fetch: self.fetch,
importScripts() {},
require,
exports,
};
inside.on('message', e => {
if (terminated) return;
Expand Down

0 comments on commit 4badee1

Please sign in to comment.