fix: resolve standalone symlinks and exclude electron from TS check

- Replace symlinks in .next/standalone with real copies for electron-builder
- Exclude electron/, dist-electron/, scripts/, release/ from tsconfig
- Use arm64 target instead of universal to avoid native module merge issues

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
7418andClaude Opus 4.6 committed 2026-02-06 21:16:13 +08:00
1 parent ff1fb38735
commit 85ec4f9b96
3 files changed
+28 -2

No files matched your search

+26
View File
@@ -1,4 +1,27 @@
import { build } from 'esbuild';
import fs from 'fs';
import path from 'path';
// Replace symlinks in standalone with real copies so electron-builder can package them
function resolveStandaloneSymlinks() {
const standaloneModules = '.next/standalone/.next/node_modules';
if (!fs.existsSync(standaloneModules)) return;
const entries = fs.readdirSync(standaloneModules);
for (const entry of entries) {
const fullPath = path.join(standaloneModules, entry);
const stat = fs.lstatSync(fullPath);
if (stat.isSymbolicLink()) {
const target = fs.readlinkSync(fullPath);
const resolved = path.resolve(standaloneModules, target);
if (fs.existsSync(resolved)) {
fs.rmSync(fullPath);
fs.cpSync(resolved, fullPath, { recursive: true });
console.log(`Resolved symlink: ${entry} -> ${target}`);
}
}
}
}
async function buildElectron() {
const shared = {
@@ -23,6 +46,9 @@ async function buildElectron() {
});
console.log('Electron build complete');
// Fix standalone symlinks after next build
resolveStandaloneSymlinks();
}
buildElectron().catch((err) => {