mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-03 15:56:17 +00:00
Update
This commit is contained in:
9
src/static/app/dist/index.html
vendored
9
src/static/app/dist/index.html
vendored
@@ -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>
|
||||
|
@@ -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"
|
||||
|
21
src/static/app/postbuild.js
Normal file
21
src/static/app/postbuild.js
Normal 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()
|
Reference in New Issue
Block a user