Skip to content

Commit 474fa52

Browse files
committed
l
1 parent 258df3d commit 474fa52

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

fix.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// fix.ts
2+
import { readFileSync, writeFileSync } from "node:fs";
3+
import { createInterface } from "node:readline";
4+
var rl = createInterface({
5+
input: process.stdin,
6+
terminal: false
7+
});
8+
rl.on("line", (line) => {
9+
const filePath = line.trim();
10+
if (!filePath) return;
11+
try {
12+
let content = readFileSync(filePath, "utf8");
13+
let changed = false;
14+
content = content.replace(/\/dist\/([^"]+)\.bundle\.js/g, (match, name) => {
15+
if (name.endsWith(".entry")) {
16+
return match;
17+
}
18+
changed = true;
19+
return `/dist/${name}.entry.bundle.js`;
20+
});
21+
content = content.replace(/\/dist\/([^"]+)\.bundle\.css/g, (match, name) => {
22+
if (name.endsWith(".entry")) {
23+
return match;
24+
}
25+
changed = true;
26+
return `/dist/${name}.entry.bundle.css`;
27+
});
28+
if (changed) {
29+
writeFileSync(filePath, content);
30+
console.log(`Updated: ${filePath}`);
31+
}
32+
} catch (err) {
33+
console.error(`Error processing ${filePath}:`, err);
34+
}
35+
});

0 commit comments

Comments
 (0)