Skip to content

fix: allow preload to expose electronAPI#9

Closed
zetaloop wants to merge 1 commit into
cocojojo5213:mainfrom
zetaloop:fix-preload-sandbox
Closed

fix: allow preload to expose electronAPI#9
zetaloop wants to merge 1 commit into
cocojojo5213:mainfrom
zetaloop:fix-preload-sandbox

Conversation

@zetaloop
Copy link
Copy Markdown
Contributor

尝试修复 Windows 中 npm run dev 无法启动以及 v1.5.1 / v1.5.2 无法启动的问题

PixPin_2026-01-18_15-06-30

请验证是否有效

@zetaloop zetaloop marked this pull request as ready for review January 18, 2026 07:33
Copilot AI review requested due to automatic review settings January 18, 2026 07:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes application startup issues on Windows by enabling sandbox mode in Electron's webPreferences. The change addresses problems with npm run dev and releases v1.5.1/v1.5.2 failing to launch on Windows.

Changes:

  • Changed sandbox setting from false to true in Electron's webPreferences configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/index.ts
@@ -81,7 +81,7 @@ function createWindow() {
nodeIntegration: false,
contextIsolation: true,
// Enable sandbox for better security on Mac
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is misleading and should be updated. It states "Enable sandbox for better security on Mac" but the sandbox setting applies to all platforms, not just Mac. Consider updating the comment to reflect that this is a general security setting, such as "Enable sandbox for better security" or "Sandbox enabled for improved security isolation".

Suggested change
// Enable sandbox for better security on Mac
// Enable sandbox for improved security isolation

Copilot uses AI. Check for mistakes.
@yanyaoli
Copy link
Copy Markdown
Contributor

也可以在index注入热更新

<script type="module">
    import { injectIntoGlobalHook } from '/@react-refresh'
    injectIntoGlobalHook(window)
    window.$RefreshReg$ = () => {}
    window.$RefreshSig$ = () => (type) => type
    window.__vite_plugin_react_preamble_installed__ = true
</script>

@zetaloop zetaloop deleted the fix-preload-sandbox branch January 18, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants