代码拉取完成,页面将自动刷新
同步操作将从 zo9494/FakeCloudMusic 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import { rmSync } from 'node:fs';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import electron from 'vite-plugin-electron';
import pkg from './package.json';
import path from 'path';
import svgLoader from 'vite-svg-loader';
import dayjs from 'dayjs';
import type { ResolvedConfig } from 'vite';
import type { NormalizedOutputOptions, OutputBundle } from 'rollup';
import { PAGE_LOGIN, PAGE_TRAY } from './const';
let viteConfig: ResolvedConfig;
// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
rmSync('dist-electron', { recursive: true, force: true });
const isServe = command === 'serve';
const isBuild = command === 'build';
const sourcemap = isServe || !!process.env.VSCODE_DEBUG;
return {
// root: __dirname + '/pages/',
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
define: {
'process.platform': `'${process.platform}'`,
},
plugins: [
vue(),
// {
// name: 'myPlugin',
// configResolved(resolvedConfig: ResolvedConfig) {
// viteConfig = resolvedConfig;
// },
// transformIndexHtml(html: string) {
// return (
// `<!--\n Version: ${pkg.version}\n Build: ${dayjs().format(
// 'YYYY/MM/DD HH:mm:ss'
// )}\n Env: ${process.env.NODE_ENV}\n-->\n` + html
// );
// },
// async writeBundle(
// options: NormalizedOutputOptions,
// bundle: OutputBundle
// ) {
// for (const file of Object.entries(bundle)) {
// const fileName: string = file[0];
// }
// },
// },
electron([
{
// Main-Process entry file of the Electron App.
entry: 'electron/main/index.ts',
onstart(options) {
if (process.env.VSCODE_DEBUG) {
console.log(
/* For `.vscode/.debug.script.mjs` */ '[startup] Electron App'
);
} else {
options.startup();
}
},
vite: {
build: {
sourcemap,
minify: isBuild,
outDir: 'dist-electron/main',
rollupOptions: {
external: Object.keys(
'dependencies' in pkg ? pkg.dependencies : {}
),
},
},
},
},
{
entry: 'electron/preload/index.ts',
onstart(options) {
// Notify the Renderer-Process to reload the page when the Preload-Scripts build is complete,
// instead of restarting the entire Electron App.
options.reload();
},
vite: {
build: {
sourcemap,
minify: isBuild,
outDir: 'dist-electron/preload',
rollupOptions: {
external: Object.keys(
'dependencies' in pkg ? pkg.dependencies : {}
),
},
},
},
},
{
entry: 'electron/preload/index.ts',
onstart(options) {
options.reload();
},
vite: {
build: {
sourcemap,
minify: isBuild,
outDir: 'dist-electron/preload',
rollupOptions: {
external: Object.keys(
'dependencies' in pkg ? pkg.dependencies : {}
),
},
},
},
},
]),
// Use Node.js API in the Renderer-process
// renderer({
// nodeIntegration: true,
// }),
svgLoader(),
],
build: {
rollupOptions: {
input: {
main: path.join(__dirname, '/index.html'),
login: path.join(__dirname, PAGE_LOGIN),
},
},
},
esbuild: {
// drop: isBuild ? ['console', 'debugger'] : undefined,
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "./src/assets/style/variables.scss";',
},
},
},
server:
process.env.VSCODE_DEBUG &&
(() => {
const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL);
return {
host: url.hostname,
port: +url.port,
};
})(),
clearScreen: false,
};
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。