bun icon indicating copy to clipboard operation
bun copied to clipboard

Panic when using watch and build

Open CoreBytee opened this issue 9 months ago • 1 comments

How can we reproduce the crash?

See script

JavaScript/TypeScript code that reproduces the crash?

Src dir must contain an index.js
MACRO_DIRECTORY Must be an folder path


import { watch } from "fs"

const outputFile = `${Bun.env.MACRO_DIRECTORY}/REDACTED.js`

watch(
    "./src/",
    { recursive: true },
    async (event, filename) => {
        console.log(event, filename)

        console.log(
            await Bun.build(
                {
                    entrypoints: ["./src/index.js"],
                    outdir: Bun.env.MACRO_DIRECTORY,
                    outfile: outputFile,
                }
            )
        )
    }
)

Relevant log output

$ bun ./scripts/watch.js
change index.js
change index.js
============================================================
Bun v1.1.9 (bb13798d) Windows x64
Args: "C:\Users\thijm\.bun\bin\bun.exe", "./scripts/watch.js"
Features: jsc dotenv tsconfig(2) 
Builtins: "bun:main" "node:fs" "node:string_decoder" "node:util/types" 
Elapsed: 1602ms | User: 15ms | Sys: 0ms
RSS: 119.84MB | Peak: 119.84MB | Commit: 0.19GB | Faults: 29506

panic(main thread): attempt to use null value
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.1.9/wa1bb13798AiogggEm/5hJ______w81j+CA0eNpLLClJzS0oUSjJVygtTlXIK83JUShLzClNBQB82AmI

error: script "dev:watch" exited with code 3```

Stack Trace (bun.report)

Bun v1.1.9 (bb13798) on windows x86_64 [AutoCommand]

panic: attempt to use null value

CoreBytee avatar May 24 '24 15:05 CoreBytee