Skip to content

Commit 1e08943

Browse files
committed
🤖 Fix React DevTools installation
- Add loadExtensionOptions with allowFileAccess - Fix extension name logging (was showing [object Object]) - Open DevTools after page loads to ensure extension is ready - Log extension name and ID for verification _Generated with `cmux`_
1 parent 9ef3519 commit 1e08943

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ function createWindow() {
159159
} else {
160160
// Development mode: load from vite dev server
161161
void mainWindow.loadURL("http://localhost:5173");
162-
mainWindow.webContents.openDevTools();
162+
// Open DevTools after React content loads
163+
mainWindow.webContents.once('did-finish-load', () => {
164+
mainWindow?.webContents.openDevTools();
165+
});
163166
}
164167

165168
mainWindow.on("closed", () => {
@@ -178,10 +181,12 @@ if (gotTheLock) {
178181
const { default: installExtension, REACT_DEVELOPER_TOOLS } = await import(
179182
"electron-devtools-installer"
180183
);
181-
const name = await installExtension(REACT_DEVELOPER_TOOLS);
182-
console.log(`Added Extension: ${name}`);
184+
const extension = await installExtension(REACT_DEVELOPER_TOOLS, {
185+
loadExtensionOptions: { allowFileAccess: true },
186+
});
187+
console.log(`✅ React DevTools installed: ${extension.name} (id: ${extension.id})`);
183188
} catch (error) {
184-
console.log("Error installing React DevTools:", error);
189+
console.log("Error installing React DevTools:", error);
185190
}
186191
}
187192

0 commit comments

Comments
 (0)