Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined is not an object when using require from a constant #1831

Closed
Tracked by #1523
nya1 opened this issue Jan 18, 2023 · 0 comments
Closed
Tracked by #1523

undefined is not an object when using require from a constant #1831

nya1 opened this issue Jan 18, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@nya1
Copy link

nya1 commented Jan 18, 2023

What version of Bun is running?

0.5.0

What platform is your computer?

Linux 6.1.4-arch1-1 x86_64 unknown

What steps can reproduce the bug?

When trying to use "require" that was assigned to a constant an error is thrown TypeError: undefined is not an object

const requireConst = require
console.log("requireConst", requireConst)
const fs = requireConst("fs") // <--- error on load

console.log(fs)

What is the expected behavior?

"fs" module is loaded without any errors

What do you see instead?

An error is thrown on module load

requireConst [Function: require]
1 | const requireConst = require
2 | console.log("requireConst", requireConst)
3 | const fs = requireConst("fs")
               ^
TypeError: undefined is not an object

Additional information

The error is thrown with any modules

@nya1 nya1 added the bug Something isn't working label Jan 18, 2023
Jarred-Sumner added a commit that referenced this issue Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
@nya1 and others