Stupid hack to have error handling for injected modules
Cynthia Foxwell 1 month ago 1 files (+8, -0)
Changed files
MODIFIED
packages/core/src/patch.ts
MODIFIED
packages/core/src/patch.ts
@@ -308,6 +308,14 @@if (wpModule.run) {modules[id] = wpModule.run;wpModule.run.__moonlight = true;+ // @ts-expect-error hacks+ wpModule.run.call = function (self, module, exports, require) {+ try {+ wpModule.run!.apply(self, [module, exports, require]);+ } catch (err) {+ logger.error(`Failed to run module "${id}":`, err);+ }+ };if (wpModule.entrypoint) entrypoints.push(id);}}