Skip to content

Bun executable does not work with uuid-by-string #25433

@DevaP11

Description

@DevaP11

What version of Bun is running?

1.3.4

What platform is your computer?

Darwin 23.3.0 arm64 arm

What steps can reproduce the bug?

Bun code with uuid-by-string

const uuidByString = getUuid("random string")
console.log(uuidByString)```

Compile this into a single executable with bun build --compile --target=bun-darwin-arm64 ./index.js --outfile executable.

Run the executable
./executable

The executable will fail with the following error
[https://github.com/user-attachments/assets/381c71f1-4a0a-4e9f-bb33-78f352896ff9]
Added the error as text below

This works fine when doing a `bun run index.js`

### What is the expected behavior?

The executable should run and log a valid value. 

### What do you see instead?

1 | require('crypto')
           ^
ReferenceError: require is not defined
      at eval (builtin:///$bunfs/root/executable:1:8)
      at nodeWrap (/$bunfs/root/executable:83:24)
      at createMethod (/$bunfs/root/executable:68:27)
      at <anonymous> (/$bunfs/root/executable:455:31)
      at <anonymous> (/$bunfs/root/executable:466:5)
      at <anonymous> (/$bunfs/root/executable:18:47)
      at <anonymous> (/$bunfs/root/executable:775:24)
      at <anonymous> (/$bunfs/root/executable:18:47)
      at <anonymous> (/$bunfs/root/executable:860:24)

Getting this error

### Additional information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions