oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.16k stars 2.77k forks source link

`panic: attempt to use null value` on concurrent `Bun.build()` #13080

Open Araxeus opened 3 months ago

Araxeus commented 3 months ago

How can we reproduce the crash?

const serverBuild = Bun.build({
    entrypoints: ['./src/server.ts'],
    outdir: 'dist',
    target: 'node',
});

const frontBuild = Bun.build({
    entrypoints: ['./pages/website.ts'],
    outdir: 'dist',
    target: 'browser',
});

await Promise.all([serverBuild, frontBuild]);

See also #12033 and #10843

Relevant log output

Bun v1.1.21 (70ca2b76) Windows x64
CPU: sse42 avx avx2 avx512
Args: "C:\Users\Araxeus\.bun\bin\bun.exe" "scripts/build.ts"
Features: jsc tsconfig_paths(2) tsconfig(2)
Builtins: "bun:main" "node:fs/promises" "node:path"
Elapsed: 46ms | User: 15ms | Sys: 62ms
RSS: 0.14GB | Peak: 0.14GB | Commit: 0.21GB | Faults: 34065

Stack Trace (bun.report)

Bun v1.1.21 (70ca2b7) on windows x86_64 [AutoCommand]

panic: attempt to use null value

Marsh1173 commented 2 months ago

Removing the await Promise.all([ and individually awaiting each build fixed the error for me, but it's not an ideal solution.