detect-embeded/embedded.js
2024-11-14 13:43:41 +08:00

25 lines
610 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, 'dist', 'index.html');
// 读取 HTML 文件
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error('读取文件出错:', err);
return;
}
const result = data.replace(
/<script crossorigin src="\/_app\.config\.js"><\/script>/g,
'<script crossorigin src="./_app.config.js"></script>'
);
fs.writeFile(filePath, result, 'utf8', (err) => {
if (err) {
console.error('写入文件出错:', err);
return;
}
console.log('html处理成功');
});
});