feat: support hot reload preload script

This commit is contained in:
草鞋没号 committed 2021-11-02 13:01:12 +08:00
1 parent d50f500bbd
commit 91384d9f37
4 files changed
+102 -10

No files matched your search

+6 -2
View File
@@ -1,16 +1,20 @@
import fs from 'fs'
import path from 'path'
import { contextBridge, ipcRenderer } from 'electron'
import { domReady } from './utils'
import { domReady, injectWsCode } from './utils'
import { useLoading } from './loading'
const isDev = process.env.NODE_ENV === 'development'
const { appendLoading, removeLoading } = useLoading()
; (async () => {
await domReady()
appendLoading()
isDev && injectWsCode({
host: '127.0.0.1',
port: process.env.PORT_WS as string,
})
})();
// ---------------------------------------------------