Replies: 1 comment
-
|
the issue is usually the path format or that the extension needs to be loaded after the window is created. try this approach: import { app, session } from "electron";
import path from "path";
import os from "os";
const isDev = !app.isPackaged;
async function loadDevTools() {
if (!isDev) return;
const reactDevToolsPath = path.join(
os.homedir(),
"Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi"
);
// get the latest version
const { readdirSync } = await import("fs");
const versions = readdirSync(reactDevToolsPath);
const latestVersion = versions.sort().pop();
if (latestVersion) {
const extensionPath = path.join(reactDevToolsPath, latestVersion);
await session.defaultSession.loadExtension(extensionPath);
console.log("React DevTools loaded from:", extensionPath);
}
}
app.whenReady().then(async () => {
await loadDevTools();
// then create your windows
});alternatively use electron-devtools-installer which handles this automatically: npm install electron-devtools-installer -Dimport installExtension, { REACT_DEVELOPER_TOOLS } from "electron-devtools-installer";
app.whenReady().then(async () => {
if (isDev) {
await installExtension(REACT_DEVELOPER_TOOLS);
}
});make sure:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've having issues with integrating react dev tools.
I tried following electrons guide but it didnt load it.
any existing examples?
Beta Was this translation helpful? Give feedback.
All reactions