Skip to content

Commit

Permalink
chore: add serve-handler for dynamic rendering in production
Browse files Browse the repository at this point in the history
  • Loading branch information
sajjadmrx committed Nov 8, 2024
1 parent 8bc8fba commit 1ebad01
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 4 deletions.
99 changes: 98 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@
"react-ga4": "^2.1.0",
"react-hot-toast": "2.4.1",
"react-icons": "5.3.0",
"serve-handler": "^6.1.6",
"style-loader": "4.0.0",
"sudo-prompt": "9.2.1",
"sweetalert2": "11.14.5",
"typesafe-i18n": "5.26.2",
"update-electron-app": "3.0.0",
"uuid": "11.0.2"
}
}
}
8 changes: 7 additions & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { EventsKeys } from '../shared/constants/eventsKeys.constant'
import { getPublicFilePath } from './shared/file'
import os from 'node:os'
import Url from 'node:url'
import serve from './shared/serve'

config()
if (isDev)
Object.defineProperty(app, 'isPackaged', {
Expand Down Expand Up @@ -81,13 +83,17 @@ async function createWindow() {
if (os.platform() === 'darwin') win.setWindowButtonVisibility(false)

win.setMenu(null)
await win.loadURL(startUrl)
await serve(win)

// await win.loadURL(startUrl)

// if (url) {
// await win.loadURL(url)
// } else {
// await win.loadFile(indexHtml)
// }
// if (isDev) win.webContents.openDevTools()

win.webContents.openDevTools()

win.webContents.on('did-finish-load', () => {
Expand Down
Loading

0 comments on commit 1ebad01

Please sign in to comment.