Skip to content

[Tech] Make it possible to disable the React developer tools #1895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2022
Merged
Changes from 1 commit
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
18 changes: 10 additions & 8 deletions src/backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,17 @@ async function createWindow(): Promise<BrowserWindow> {
}

if (!app.isPackaged) {
/* eslint-disable @typescript-eslint/ban-ts-comment */
//@ts-ignore
import('electron-devtools-installer').then((devtools) => {
const { default: installExtension, REACT_DEVELOPER_TOOLS } = devtools
if (!process.env.HEROIC_NO_REACT_DEVTOOLS) {
import('electron-devtools-installer').then((devtools) => {
const { default: installExtension, REACT_DEVELOPER_TOOLS } = devtools

installExtension(REACT_DEVELOPER_TOOLS).catch((err: string) => {
logWarning(['An error occurred: ', err], { prefix: LogPrefix.Backend })
installExtension(REACT_DEVELOPER_TOOLS).catch((err: string) => {
logWarning(['An error occurred: ', err], {
prefix: LogPrefix.Backend
})
})
})
})
}
mainWindow.loadURL('http://localhost:5173')
// Open the DevTools.
mainWindow.webContents.openDevTools()
Expand Down Expand Up @@ -779,7 +781,7 @@ ipcMain.handle(
}

try {
// @ts-ignore This is actually fine as long as the frontend always passes the right InstallPlatform for the right runner
// @ts-expect-error This is actually fine as long as the frontend always passes the right InstallPlatform for the right runner
const info = await getGame(game, runner).getInstallInfo(installPlatform)
return info
} catch (error) {
Expand Down