pack: vutron now uses the vite compiler

This commit is contained in:
leejooy96 committed 2022-10-06 10:26:30 +09:00
1 parent fce96211ba
commit 02b13d8fb7
30 files changed
+2064 -11005

No files matched your search

-7
View File
@@ -1,12 +1,7 @@
import { app, BrowserWindow } from 'electron'
import Constants from './utils/Constants'
import { join } from 'path'
import * as electronRemote from '@electron/remote/main'
const getAppIcon = () => {
return join(__static, Constants.APP_ICON)
}
const exitApp = (mainWindow) => {
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.hide()
@@ -18,7 +13,6 @@ const exitApp = (mainWindow) => {
export const createMainWindow = async (mainWindow) => {
mainWindow = new BrowserWindow({
title: Constants.APP_NAME,
icon: getAppIcon(),
show: false,
width: Constants.IS_DEV_ENV ? 1500 : 1200,
height: 650,
@@ -64,7 +58,6 @@ export const createErrorWindow = async (errorWindow, mainWindow, details) => {
errorWindow = new BrowserWindow({
title: Constants.APP_NAME,
icon: getAppIcon(),
show: false,
resizable: Constants.IS_DEV_ENV,
webPreferences: Constants.DEFAULT_WEB_PREFERENCES
-10
View File
@@ -1,10 +0,0 @@
import { app } from 'electron'
import './index'
import * as electronDevtoolsInstaller from 'electron-devtools-installer'
app.on('ready', async () => {
await electronDevtoolsInstaller.default(electronDevtoolsInstaller.VUEJS_DEVTOOLS)
.catch(e => {
console.log(`Failed to install Vue Devtools \n(${e})`)
})
})
-8
View File
@@ -1,7 +1,4 @@
import 'v8-compile-cache'
import { app } from 'electron'
import { join, dirname } from 'path'
import { fileURLToPath } from 'url'
import Constants from './utils/Constants'
import { createErrorWindow, createMainWindow } from './MainRunner'
import Menus from './utils/Menus'
@@ -10,11 +7,6 @@ let mainWindow
let errorWindow
app.on('ready', () => {
if (!Constants.IS_DEV_ENV) {
global.__static = join(dirname(fileURLToPath(import.meta.url)), '/static')
.replace(/\\/g, '\\\\')
}
Menus.macOSDisableDefaultMenuItem()
mainWindow = createMainWindow(mainWindow)
+3 -3
View File
@@ -1,8 +1,8 @@
import { platform } from 'os'
import { join } from 'path'
export default class Constants {
static APP_NAME = 'Vutron'
static APP_ICON = 'app-icon.png'
static IS_DEV_ENV = process.env.NODE_ENV === 'development'
@@ -15,6 +15,6 @@ export default class Constants {
enableRemoteModule: true
}
static APP_INDEX_URL_DEV = 'http://localhost:9080/index.html'
static APP_INDEX_URL_PROD = './dist/electron/index.html'
static APP_INDEX_URL_DEV = 'http://localhost:5173/index.html'
static APP_INDEX_URL_PROD = join(__dirname, '../index.html')
}