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

"__require is not defined" error #17632

Open
johnfn opened this issue Feb 24, 2025 · 1 comment
Open

"__require is not defined" error #17632

johnfn opened this issue Feb 24, 2025 · 1 comment
Labels
bake:dev hot-reloading dev server for client+server applications bug Something isn't working

Comments

@johnfn
Copy link

johnfn commented Feb 24, 2025

What version of Bun is running?

1.2.3

What platform is your computer?

macos

What steps can reproduce the bug?

I can't get a great repo because I am running this at work and the stacktrace doesn't point at a particularly problematic file.

What is the expected behavior?

No error.

What do you see instead?

I tried to use the new bun dev server with bun index.html, but I see this error:

frontend ReferenceError: __require is not defined
      at e (http://localhost:3000/_bun/client/index-000000002ee2e723.js:51667:18)
      at http://localhost:3000/_bun/client/index-000000002ee2e723.js:51671:8
      at http://localhost:3000/_bun/client/index-000000002ee2e723.js:51629:26
      at node_modules/localforage/dist/localforage.js (http://localhost:3000/_bun/client/index-000000002ee2e723.js:51645:7)
      at node_modules/@sentry/integrations/esm/offline.js (http://localhost:3000/_bun/client/index-000000002ee2e723.js:51541:39)
      at async node_modules/@sentry/integrations/esm/index.js (http://localhost:3000/_bun/client/index-000000002ee2e723.js:50983:27)

None of the three files listed have a symbol named __require, so I'm stumped.

Additional information

No response

@johnfn johnfn added bug Something isn't working needs triage labels Feb 24, 2025
@paperclover paperclover added bake:dev hot-reloading dev server for client+server applications and removed needs triage labels Feb 24, 2025
@paperclover
Copy link
Member

i apologize for missing source maps. that is really weird.

if you navigate your browser to http://localhost:3000/_bun/client/index-000000002ee2e723.js:51667:18, open the file in text editor, you should be able to scroll upwards to find the nearest function wrapper. if you can share code around where __require shows up (especially if it is happening in a file from node_modules/) that would help.

example of what these files look like with the Fold Level 2 action in vscode ran.

Image

i have a suspicion what this is without seeing that though, but i am fixing some other at the moment before i do deep investigations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bake:dev hot-reloading dev server for client+server applications bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants