Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/profiling-node/src/cpu_profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
return createdRequire(`${binaryPath}.node`);
}

if (process.versions.electron) {
try {
// @electron/rebuild generates the binary in the generic node-gyp directory
return createdRequire('../../build/Release/sentry_cpu_profiler.node');
} catch (_) {
// eslint-disable-next-line no-console
console.warn(
"Could not find '@sentry/profiling-node' binary. You should use '@electron/rebuild' to rebuild the native module.",
);
}
}

// We need the fallthrough so that in the end, we can fallback to the dynamic require.
// This is for cases where precompiled binaries were not provided, but may have been compiled from source.
if (platform === 'darwin') {
Expand Down
Loading