Open abrcdf1023 opened 2 months ago
@abrcdf1023 I've just ran into this problem, did you find a way to solve this issue? Or could you expand on your solution more? Could I use patch package?
I wrote a local script to fix this, just in case anyone wants it I made a file in the root folder called fix-urls.js ` import { readFile, writeFile } from "fs/promises" import { resolve } from "path"
const fixUrls = async (filePath) => { try { const data = await readFile(filePath, "utf8") const result = data.replace(/https:\/([^/])/g, "https://$1") await writeFile(filePath, result, "utf8") console.log("URLs fixed successfully!") } catch (err) { console.error("Error processing file:", err) } }
// Adjust the path as necessary to point to your index.html or other affected files const indexPath = resolve("./dist/index.html") fixUrls(indexPath) `
And then changed my build script in package.json to this
"build": "tsc && vite build && node fix-urls.js",
How to
vite.config
vite build
vite build with wrong href index.html
Should be index.html
Root Cause
Solution