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( /' ); fs.writeFile(filePath, result, 'utf8', (err) => { if (err) { console.error('写入文件出错:', err); return; } console.log('html处理成功!'); }); });