This commit is contained in:
Donald Zou
2025-08-16 23:19:48 +08:00
parent 4b6c5db904
commit 4beb61c3af
3 changed files with 26 additions and 6 deletions

View File

@@ -6,15 +6,14 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="application-name" content="WGDashboard">
<meta name="apple-mobile-web-app-title" content="WGDashboard">
<link rel="manifest" href="/static/app/dist/json/manifest.json">
<link rel="icon" href="/static/app/dist/img/Logo-2-512x512.png">
<link rel="manifest" href="./static/app/dist/json/manifest.json">
<link rel="icon" href="./static/app/dist/img/Logo-2-512x512.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WGDashboard</title>
<script type="module" crossorigin src="/static/app/dist/assets/index-B-jc5mKC.js"></script>
<link rel="stylesheet" crossorigin href="/static/app/dist/assets/index-C4LstPme.css">
<script type="module" crossorigin src="./static/app/dist/assets/index-B-jc5mKC.js"></script>
<link rel="stylesheet" crossorigin href="./static/app/dist/assets/index-C4LstPme.css">
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -6,7 +6,7 @@
"module": "es2022",
"scripts": {
"dev": "vite",
"build": "vite build",
"build": "vite build && node postbuild.js",
"buildcommitpush": "./build.sh",
"build electron": "vite build && vite build --mode electron && cd ../../../../WGDashboard-Desktop && /opt/homebrew/bin/npm run \"electron dist\"",
"preview": "vite preview"

View File

@@ -0,0 +1,21 @@
import fs from 'fs'
import path from 'path'
function makePathsRelative() {
const indexPath = path.join('dist', 'index.html')
if (!fs.existsSync(indexPath)) {
console.error('index.html not found in dist folder')
return
}
let html = fs.readFileSync(indexPath, 'utf8')
// Handle cases where Vite already added a base path
html = html.replace(/(href|src)="\/static\/app\/dist\//g, '$1="./static/app/dist/')
fs.writeFileSync(indexPath, html)
console.log('✅ Converted all paths to ./static/app/dist/ in index.html')
}
makePathsRelative()