Ensure rollup linux binary in tauri prebuild

This commit is contained in:
Shantur Rathore
2025-11-27 20:11:02 +00:00
parent ccd65fbc74
commit 9fa436b0b8

View File

@@ -114,6 +114,40 @@ function ensureUiDevDependencies() {
})
}
function ensureRollupPlatformBinary() {
if (process.platform !== "linux" || process.arch !== "x64") {
return
}
const rollupLinuxPath = path.join(
workspaceRoot,
"node_modules",
"@rollup",
"rollup-linux-x64-gnu",
)
if (fs.existsSync(rollupLinuxPath)) {
return
}
let rollupVersion = ""
try {
rollupVersion = require(path.join(workspaceRoot, "node_modules", "rollup", "package.json")).version
} catch (error) {
// leave version empty; fallback install will use latest compatible
}
const packageSpec = rollupVersion
? `@rollup/rollup-linux-x64-gnu@${rollupVersion}`
: "@rollup/rollup-linux-x64-gnu"
console.log("[prebuild] installing rollup linux binary (optional dep workaround)...")
execSync(`npm install ${packageSpec} --no-save --ignore-scripts --fund=false --audit=false`, {
cwd: workspaceRoot,
stdio: "inherit",
})
}
function copyServerArtifacts() {
fs.rmSync(serverDest, { recursive: true, force: true })
fs.mkdirSync(serverDest, { recursive: true })
@@ -151,6 +185,7 @@ function copyUiLoadingAssets() {
ensureServerDevDependencies()
ensureUiDevDependencies()
ensureRollupPlatformBinary()
ensureServerBuild()
ensureUiBuild()
ensureServerDependencies()