11const DEV_MODE = process . env . HTK_DEV === 'true' ;
22
33// Set up error handling before everything else:
4- import { logError , addBreadcrumb } from './errors' ;
4+ import { logError , addBreadcrumb } from './errors.ts ' ;
55
66import { spawn , ChildProcess } from 'child_process' ;
77import * as os from 'os' ;
@@ -12,22 +12,22 @@ import * as crypto from 'crypto';
1212import * as querystring from 'querystring' ;
1313import { URL } from 'url' ;
1414import { app , BrowserWindow , shell , Menu , dialog , session , ipcMain } from 'electron' ;
15- import * as yargs from 'yargs' ;
15+ import yargs from 'yargs' ;
1616import * as semver from 'semver' ;
1717const rmRF = ( p : string ) => fs . rm ( p , { recursive : true , force : true } ) ;
1818
1919import windowStateKeeper from 'electron-window-state' ;
2020import { getSystemProxy } from 'os-proxy-config' ;
21- import registerContextMenu = require ( 'electron-context-menu' ) ;
21+ import registerContextMenu from 'electron-context-menu' ;
2222import * as sudoPrompt from '@expo/sudo-prompt' ;
2323import { getDeferred , delay , ErrorLike } from '@httptoolkit/util' ;
2424
25- import { getMenu , shouldAutoHideMenu } from './menu' ;
26- import { ContextMenuDefinition , openContextMenu } from './context-menu' ;
27- import { stopServer } from './stop-server' ;
28- import { getDeviceDetails } from './device' ;
25+ import { getMenu , shouldAutoHideMenu } from './menu.ts ' ;
26+ import { ContextMenuDefinition , openContextMenu } from './context-menu.ts ' ;
27+ import { stopServer } from './stop-server.ts ' ;
28+ import { getDeviceDetails } from './device.ts ' ;
2929
30- const packageJson = require ( '../package.json' ) ;
30+ import packageJson from '../package.json' with { type : 'json' } ;
3131
3232const isWindows = os . platform ( ) === 'win32' ;
3333
@@ -81,7 +81,7 @@ const createWindow = (logStream: WriteStream) => {
8181 height : windowState . height ,
8282
8383 webPreferences : {
84- preload : path . join ( __dirname , 'preload.js' ) ,
84+ preload : path . join ( import . meta . dirname , 'preload.js' ) ,
8585 contextIsolation : true ,
8686 nodeIntegration : false
8787 } ,
0 commit comments