10.10综合交易所原始源码_移动端
admin
2026-01-06 42faef34194c466f03e29d75a63ae502e4213044
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * vue 一键修复dist包path
 * vite.config.js 先配置 @vitejs/plugin-legacy 和 base:'./'
 * 参考:https://www.jianshu.com/p/d44d14bc5344
 * 配置完成后 路径正常后 再 node fixDistPath.js
 */
 
import fs from 'fs';
const distPath = './dist/index.html';//打包路径的index.html
let htmlText = fs.readFileSync(distPath, 'utf8');
let resultText = '';
let htmlArr = htmlText.match(/.*\n/g) || []; //IOS系统执行 APP
//let htmlArr = htmlText.match(/.*/g) || []; //windows执行 APP
htmlArr.forEach(str => {
    str = str.replace(/\s?nomodule\s?/g, ' ');
    str = str.replace(/\s?crossorigin\s?/g, ' ');
    str = str.replace(/data-src/g, 'src');
    if (!/type="module"/i.test(str)) resultText += str;
});
fs.writeFileSync(distPath, resultText, 'utf8');
console.log('success');