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

"frog dev" command fails due to Bun integration issue #403

Closed
1 task done
matthewmorek opened this issue Jul 9, 2024 · 3 comments
Closed
1 task done

"frog dev" command fails due to Bun integration issue #403

matthewmorek opened this issue Jul 9, 2024 · 3 comments

Comments

@matthewmorek
Copy link

matthewmorek commented Jul 9, 2024

Describe the bug

When running the frog dev command, an error occurs related to the Bun integration with hono/bun. The error suggests that Bun is not defined, which prevents the development server from starting correctly, though this is incorrect because Bun is available in the system.

Looks like Frog is not reading Bun dependencies correctly, although the bun serve runs perfectly fine. This affects local development environment only.

Full error log:

$ frog dev
19:07:44 [vite] Error when evaluating SSR module frames-frog-api/src/index.tsx: failed to import "hono/bun"
|- ReferenceError: Bun is not defined
    at frames-frog-api/node_modules/hono/dist/adapter/bun/ssg.js:3:17
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async nodeImport (frames-frog-api/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:53536:15)
    at async ssrImport (frames-frog-api/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:53392:16)
    at async eval (/Users/mmorek/Projects/ponder/frames-frog-api/src/index.tsx:6:31)
    at async instantiateModule (frames-frog-api/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:53451:5)

node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

ReferenceError: Bun is not defined
    at frames-frog-api/node_modules/hono/dist/adapter/bun/ssg.js:3:17
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async nodeImport (frames-frog-api/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:53536:15)
    at async ssrImport (frames-frog-api/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:53392:16)
    at async eval (/Users/mmorek/Projects/ponder/frames-frog-api/src/index.tsx:6:31)
    at async instantiateModule (frames-frog-api/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:53451:5)

Node.js v20.12.2
error: script "dev" exited with code 1

Link to Minimal Reproducible Example

https://github.com/matthewmorek/frames-frog-api

Steps To Reproduce

  1. Install Bun
  2. Install repo dependencies
  3. Run bun dev

From scratch:

  1. Create a new project using steps from the Bun guide in Frog.fm docs
  2. Change import source for serveStatic from frog/serve-static to hono/bun
  3. Run bun dev

Frog Version

0.12.2

TypeScript Version

5.5.3

Check existing issues

Anything else?

No response

@tmm
Copy link
Member

tmm commented Jul 9, 2024

- import { serveStatic } from 'hono/bun'
+ import { serveStatic } from 'frog/serve-static'

@tmm tmm closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
@matthewmorek
Copy link
Author

If that's the case, the Frog integration docs for Bun need to be updated as they currently guide people to add hono/bun instead, causing the issue to begine with. See below:
image

@tmm
Copy link
Member

tmm commented Jul 9, 2024

Feel free to create a pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants