Skip to content

Commit 54de0e5

Browse files
fix(electron): compatible with windows (#153)
1 parent fa24276 commit 54de0e5

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

packages/electron/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"execa": "^8.0.1",
3737
"h3": "^1.9.0",
3838
"ip": "^1.1.8",
39+
"pathe": "^1.1.1",
3940
"socket.io": "^4.7.2",
4041
"socket.io-client": "^4.7.2"
4142
},

packages/electron/scripts/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { resolve as _resolve } from 'node:path'
1+
import { resolve as _resolve } from 'pathe'
22
import type { Options } from 'tsup'
33
import { build } from 'tsup'
44
import { build as unbuild } from 'unbuild'

packages/electron/src/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function createWindow() {
2121
})
2222
const appEntryPath = path.join(__dirname, '../app.html')
2323
const url = new URL(`file://${appEntryPath}`).toString()
24+
mainWindow.setMenu(null)
2425
mainWindow.loadURL(new URL(url).toString())
2526

2627
mainWindow.on('closed', () => {

packages/electron/src/cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { execaSync } from 'execa'
22
import electron from 'electron'
3+
import { resolve } from 'pathe'
34

4-
const appPath = new URL('../dist/app.cjs', import.meta.url).pathname
5+
const appPath = resolve(new URL('../dist/app.cjs', import.meta.url).pathname)
56
const argv = process.argv.slice(2)
67

78
const result = execaSync(electron as unknown as string, [appPath].concat(argv), {
89
stdio: 'ignore',
10+
windowsHide: false,
911
})
1012

1113
process.exit(result.exitCode)

pnpm-lock.yaml

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)