You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I used patch-package to patch chance@1.1.8 for the project I'm working on.
I am using chance (via chance-generators) in a Web Worker environment (in Brave/Chromium 103). The module appears to take some special action if the environment appears to be a Web Worker. However, Chromium immediately crashes the IIFE on a undefined reference for 'chance'. I tried creating a variable with 'var chance;' in the main Web Worker script, but this had no impact.
I merely added a 'let' keyword before the assignment below and everything is now working fine.
Here is the diff that solved my problem:
diff --git a/node_modules/chance/chance.js b/node_modules/chance/chance.js
index 2b68a0a..5f483af 100644
--- a/node_modules/chance/chance.js+++ b/node_modules/chance/chance.js@@ -7889,7 +7889,7 @@ options,
// if there is a importsScrips object define chance for worker
// allows worker to use full Chance functionality with seed
if (typeof importScripts !== 'undefined') {
- chance = new Chance();+ let chance = new Chance();
self.Chance = Chance;
}
Hi! 馃憢
Firstly, thanks for your work on this project! 馃檪
Today I used patch-package to patch
chance@1.1.8
for the project I'm working on.I am using chance (via chance-generators) in a Web Worker environment (in Brave/Chromium 103). The module appears to take some special action if the environment appears to be a Web Worker. However, Chromium immediately crashes the IIFE on a undefined reference for 'chance'. I tried creating a variable with 'var chance;' in the main Web Worker script, but this had no impact.
I merely added a 'let' keyword before the assignment below and everything is now working fine.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: