feat: 调整脚本目录

This commit is contained in:
DEV_DSW
2026-03-02 11:39:44 +08:00
parent 011c28d945
commit 26419b70f4
2 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
const fs = require('fs')
const path = require('path')
const entryPath = path.join(process.cwd(), '.vite/build/main.js')
const jscPath = path.join(process.cwd(), '.vite/build/main.jsc')
if (!fs.existsSync(entryPath)) {
throw new Error('主进程入口未找到,请先构建主进程')
}
if (!fs.existsSync(jscPath)) {
const bytenode = require('bytenode')
bytenode.compileFile({ filename: entryPath, output: jscPath })
}
const content = [
"require('bytenode')",
"require('./main.jsc')"
].join('\n')
const outputPath = entryPath
fs.mkdirSync(path.dirname(outputPath), { recursive: true })
fs.writeFileSync(outputPath, content)
console.log(`生产环境入口文件已生成: ${outputPath}`)