21 lines
745 B
1
import { join } from "node:path";
2
import { Module } from "node:module";
3
4
const logger = moonlightHost.getLogger("disableSentry");
5
6
if (moonlightHost.asarPath !== "moonlightDesktop") {
7
try {
8
const hostSentryPath = require.resolve(join(moonlightHost.asarPath, "node_modules", "@sentry", "electron"));
9
require.cache[hostSentryPath] = new Module(hostSentryPath, require.cache[require.resolve(moonlightHost.asarPath)]);
10
require.cache[hostSentryPath]!.exports = {
11
init: () => {},
12
captureException: () => {},
13
setTag: () => {},
14
setUser: () => {},
15
captureMessage: () => {}
16
};
17
logger.debug("Stubbed Sentry host side!");
18
} catch (err) {
19
logger.error("Failed to stub Sentry host side:", err);
20
}
21
}
22