Skip to content

Commit ef338be

Browse files
committed
Add Electron check and warning
1 parent 7e674f8 commit ef338be

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

packages/profiling-node/src/cpu_profiler.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,16 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
5454
return createdRequire(`${binaryPath}.node`);
5555
}
5656

57-
// @electron/rebuild generates the binary in the generic node-gyp directory
58-
try {
59-
return createdRequire('../../build/Release/sentry_cpu_profiler.node');
60-
} catch (_) {
61-
// ignore
57+
if (process.versions.electron) {
58+
try {
59+
// @electron/rebuild generates the binary in the generic node-gyp directory
60+
return createdRequire('../../build/Release/sentry_cpu_profiler.node');
61+
} catch (_) {
62+
// eslint-disable-next-line no-console
63+
console.warn(
64+
"Could not find '@sentry/profiling-node' binary. You should use '@electron/rebuild' to rebuild the native module.",
65+
);
66+
}
6267
}
6368

6469
// We need the fallthrough so that in the end, we can fallback to the dynamic require.

0 commit comments

Comments
 (0)