Replies: 1 comment
-
I made a workaround with a small vite plugin I wrote. import { load } from "cheerio";
import { defineConfig, type PluginOption } from "vite";
const transAssetsPath: PluginOption = {
name: "transform-asset-paths",
transformIndexHtml(html) {
const $ = load(html);
$("html head script").each((_, script) => {
const type = $(script).attr("type");
const src = $(script).attr("src");
if (type === "module" && src?.startsWith("./assets/")) {
$(script).attr("src", src.replace(new RegExp("^./assets/"), "/assets/"));
}
});
return $.html();
},
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think electron-vite generates index.html with relative paths for assets.
I want the paths in index.html to be like this, absolute path. It's convenient for my use-case.
Is it possible?
Beta Was this translation helpful? Give feedback.
All reactions