build(electron): use live origin http protocol instead of file:// (#8464)

fix AF-1428
This commit is contained in:
pengx17
2024-10-15 05:42:52 +00:00
parent 9970138009
commit 3d3864fa5b
6 changed files with 55 additions and 121 deletions

View File

@@ -71,9 +71,9 @@ if (!process.env.SKIP_WEB_BUILD) {
const fullpath = path.join(affineWebOutDir, file);
let content = await fs.readFile(fullpath, 'utf-8');
// replace # sourceMappingURL=76-6370cd185962bc89.js.map
// to # sourceMappingURL=assets://./{dir}/76-6370cd185962bc89.js.map
// to # sourceMappingURL=/{dir}/76-6370cd185962bc89.js.map
content = content.replace(/# sourceMappingURL=(.*)\.map/g, (_, p1) => {
return `# sourceMappingURL=assets://./${dir}/${p1}.map`;
return `# sourceMappingURL=assets:///${dir}/${p1}.map`;
});
try {
await fs.writeFile(fullpath, content);