Skip to content

Commit

Permalink
url value fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminDreasond committed Aug 14, 2023
1 parent df7f574 commit d9453d7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (!app.requestSingleInstanceLock()) {
let win: BrowserWindow | null = null;
// Here, you can also use other preload
const preload = join(__dirname, '../preload/index.js');
const url = process.env.VITE_DEV_SERVER_URL;
const tinyUrl = process.env.VITE_DEV_SERVER_URL;
const indexHtml = join(process.env.DIST, 'index.html');

async function createWindow() {
Expand All @@ -55,9 +55,9 @@ async function createWindow() {
},
});

if (url) {
if (tinyUrl) {
// electron-vite-vue#298
win.loadURL(url);
win.loadURL(tinyUrl);
// Open devTool if the app is not packaged
win.webContents.openDevTools();
} else {
Expand All @@ -70,8 +70,8 @@ async function createWindow() {
});

// Make all links open with the browser, not with the application
win.webContents.setWindowOpenHandler(({ webUrl }) => {
if (webUrl.startsWith('https:')) shell.openExternal(webUrl);
win.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith('https:')) shell.openExternal(url);
return { action: 'deny' };
});

Expand Down Expand Up @@ -114,7 +114,7 @@ ipcMain.handle('open-win', (_, arg) => {
});

if (process.env.VITE_DEV_SERVER_URL) {
childWindow.loadURL(`${url}#${arg}`);
childWindow.loadURL(`${tinyUrl}#${arg}`);
} else {
childWindow.loadFile(indexHtml, { hash: arg });
}
Expand Down

0 comments on commit d9453d7

Please sign in to comment.