-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch-angular-fire.js
More file actions
29 lines (26 loc) · 958 Bytes
/
patch-angular-fire.js
File metadata and controls
29 lines (26 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const fs = require('fs');
const path = require('path');
function replaceInFile(filePath) {
if (!fs.existsSync(filePath)) return;
let content = fs.readFileSync(filePath, 'utf8');
if (content.includes('!!module.hot')) {
content = content.replace(/!!module\.hot/g, 'false');
fs.writeFileSync(filePath, content, 'utf8');
console.log('Patched', filePath);
}
}
function processDirectory(dir) {
if (!fs.existsSync(dir)) return;
const files = fs.readdirSync(dir);
for (const file of files) {
const fullPath = path.join(dir, file);
if (fs.statSync(fullPath).isDirectory()) {
processDirectory(fullPath);
} else if (fullPath.endsWith('.js') || fullPath.endsWith('.mjs')) {
replaceInFile(fullPath);
}
}
}
const targetDir = path.join(__dirname, 'node_modules', '@angular', 'fire');
processDirectory(targetDir);
console.log('Angular Fire patch complete.');