At src/main/windows create a folder named as MyWindow and inside this folder an index.ts with the following content:
import { createWindow } from 'main/factories'
export function MyWindow() {
const window = createWindow({
id: 'myWindow',
title: 'My Window',
width: 450,
height: 320,
alwaysOnTop: true,
})
return window
}Then, at src/main/windows/index.ts, add the MyWindow:
export * from './MyWindow'
export * from './About'
export * from './Main'Now, at src/main/index.ts, you can use it like:
import { app } from 'electron'
import { makeAppSetup } from './factories'
import {
registerAboutWindowCreationByIPC,
MainWindow,
MyWindow,
} from './windows'
app.whenReady().then(async () => {
await makeAppSetup(MainWindow)
registerAboutWindowCreationByIPC()
MyWindow()
})