从webpack迁移到vite
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BrowserWindow, dialog } from 'electron'
|
||||
import { join } from 'path'
|
||||
import path from 'node:path'
|
||||
import { createTaskBarButtons, getWindowSizeInfo } from './utils'
|
||||
import { isLinux, isWin } from '@common/utils'
|
||||
import { openDevTools as handleOpenDevTools } from '@main/utils'
|
||||
@@ -96,7 +96,7 @@ export const createWindow = () => {
|
||||
}
|
||||
browserWindow = new BrowserWindow(options)
|
||||
|
||||
const winURL = global.isDev ? 'http://localhost:9080' : `file://${join(encodePath(__dirname), 'index.html')}`
|
||||
const winURL = process.env.NODE_ENV !== 'production' ? 'http://localhost:9080' : `file://${path.join(encodePath(__dirname), '../renderer/index.html')}`
|
||||
void browserWindow.loadURL(winURL + `?dt=${!!global.envParams.cmdParams.dt}&dark=${shouldUseDarkColors}&theme=${encodeURIComponent(JSON.stringify(theme))}`)
|
||||
|
||||
winEvent()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createInflate, constants as zlibConstants } from 'node:zlib'
|
||||
// import path from 'path'
|
||||
import path from 'node:path'
|
||||
import { mainHandle } from '@common/mainIpc'
|
||||
import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames'
|
||||
|
||||
@@ -38,9 +38,9 @@ const decode = async(str: string): Promise<string> => {
|
||||
const handleDecode = async(lrc: string, tlrc: string, rlrc: string) => {
|
||||
if (!qrc_decode) {
|
||||
// const nativeBindingPath = path.join(__dirname, '../build/Release/qrc_decode.node')
|
||||
// const nativeBindingPath = isDev ? path.join(__dirname, '../build/Release/qrc_decode.node')
|
||||
// const nativeBindingPath = process.env.NODE_ENV !== 'production' ? path.join(__dirname, '../build/Release/qrc_decode.node')
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const addon = require('qrc_decode.node')
|
||||
const addon = require(path.join(__QRC_DECODE_NODE_PATH__, 'qrc_decode.node'))
|
||||
// console.log(addon)
|
||||
qrc_decode = addon.qrc_decode
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// import fs from 'fs'
|
||||
import { join } from 'path'
|
||||
import path from 'node:path'
|
||||
import { type WindowSize, windowSizeList } from '@common/config'
|
||||
import { nativeImage } from 'electron'
|
||||
|
||||
@@ -8,7 +8,7 @@ export const getWindowSizeInfo = (windowSizeId: number | string): WindowSize =>
|
||||
}
|
||||
|
||||
const getIconPath = (name: string): Electron.NativeImage => {
|
||||
return nativeImage.createFromPath(join(global.staticPath, 'images/taskbar', name + '.png'))
|
||||
return nativeImage.createFromPath(path.join(global.staticPath, 'images/taskbar', name + '.png'))
|
||||
}
|
||||
|
||||
export const createTaskBarButtons = ({
|
||||
|
||||
Reference in New Issue
Block a user