feat:uniapp模块
This commit is contained in:
26
uniapp/scripts/patch-app-config.js
Normal file
26
uniapp/scripts/patch-app-config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 强制 App 使用 webview 渲染,避免 renderer:auto 在部分设备上卡启动页。
|
||||
*/
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const root = path.resolve(__dirname, '..')
|
||||
|
||||
const targets = [
|
||||
path.join(root, 'dist/build/app/app-config-service.js'),
|
||||
path.join(root, 'dist/build/app-plus/app-config-service.js')
|
||||
]
|
||||
|
||||
for (const file of targets) {
|
||||
if (!fs.existsSync(file)) continue
|
||||
let content = fs.readFileSync(file, 'utf8')
|
||||
const next = content
|
||||
.replace(/"renderer":"auto"/g, '"renderer":"webview"')
|
||||
.replace(/"waiting":true/g, '"waiting":false')
|
||||
if (next !== content) {
|
||||
fs.writeFileSync(file, next, 'utf8')
|
||||
console.log('[patch-app-config] patched', path.relative(root, file))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user