chore(scripts/build): add dev hint when no output from hermesc

This commit is contained in:
PalmDevs 2025-05-22 02:49:24 +07:00
parent ce726accca
commit c2e640388e
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -171,20 +171,22 @@ function hermesCPlugin({ after, before, flags }: { flags?: string[]; before?: ()
const file = bundle['revenge.js'] as OutputChunk
if (!file || !file.code) throw new Error('No code to compile')
const cmd = Bun.spawnSync(
[
`./node_modules/@unbound-mod/hermesc/${process.platform}/${binPath}`,
'-emit-binary',
...(flags ?? []),
],
{
stdin: new Blob([file.code]),
stdout: 'pipe',
},
)
const cmdlist = [
`./node_modules/@unbound-mod/hermesc/${process.platform}/${binPath}`,
'-emit-binary',
...(flags ?? []),
]
const cmd = Bun.spawnSync(cmdlist, {
stdin: new Blob([file.code]),
stdout: 'pipe',
})
const buf = cmd.stdout
if (!buf.length) throw new Error('No output from hermesc')
if (!buf.length)
throw new Error(
`No output from hermesc. Probably a compilation error.\nTry running the command manually: ${cmdlist.join(' ')}`,
)
this.emitFile({
type: 'asset',