It is not possible (is it? I've been trying for a while now and have concluded it is not) to serve two different directories when the electron app has two windows.
Something like this
const loadURLOne = serve({ directory: 'one' })
const loadURLTwo = serve({ directory: 'two' })
function createWindow() {
const oneWindow = new BrowserWindow({
width: 1800,
height: 1600,
})
const twoWindow = new BrowserWindow({
width: 1800,
height: 1600,
})
if (isDev) {
oneWindow.loadURL('http://localhost:3000/one')
twoWindow.loadURL('http://localhost:3000/two')
} else {
loadURLOne(oneWindow)
loadURLTwo(twoWindow)
}
This in dev
works as expected (the localhost is an astro site)
But in build
I can only get two windows opened that point to the same directory (the first one).
So this would be a nice feature to have in mind, if it is feasible.
EDIT: Or a variant would be to point, instead of a directory, to a file
const loadURLOne = serve({ directory: '.', file: 'index.html' })
const loadURLTwo = serve({ directory: '.', file: 'two.html' })
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too