honojs / vite-plugins

Vite Plugins for Hono
https://hono.dev
107 stars 28 forks source link

upgrading vite-cloudflare-pages & vite-dev-server causes crash #154

Closed tomByrer closed 2 weeks ago

tomByrer commented 2 weeks ago

Steps: git clone https://github.com/yusukebe/url-shortener (I hope the code looks familiar ;) ) install packages, run dev works fine

Upgrade packages

    "@hono/vite-cloudflare-pages": "^0.4.2",
    "@hono/vite-dev-server": "^0.13.0",

install, run dev creates error:

 Cannot set property navigator of #<Object> which has only a getter
    at Function.assign (<anonymous>)
    at cloudflareAdapter (file:///home/person/c/cf/url-shortener/node_modules/@hono/vite-dev-server/dist/adapter/cloudflare.js:8:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getAdapterFromOptions (file:///home/person/c/cf/url-shortener/node_modules/@hono/vite-dev-server/dist/dev-server.js:123:15)
    at async getRequestListener.overrideGlobalObjects (file:///home/person/c/cf/url-shortener/node_modules/@hono/vite-dev-server/dist/dev-server.js:59:31)
    at async responseViaResponseObject (file:///home/person/c/cf/url-shortener/node_modules/@hono/node-server/dist/index.mjs:330:15
Click outside, press Esc key, or fix the code to dismiss.
You can also disable this overlay by setting server.hmr.overlay to false in vite.config.ts.

I'm using your repo to build a project, & I can't find upgrade notes anywhere. TIA

JoshStwrt commented 2 weeks ago

I'm experiencing the same problem. I clone this repo from @yusukebe and the latest version of @hono/vite-dev-server is throwing this error. I had different issues on version 0.12.x. It's working if I downgrade to 0.11.1.

yusukebe commented 2 weeks ago

Hi @tomByrer @JoshStwrt

Hmmm. It's weird. I've introduced some changes to @hono/vite-dev-server, but if you set the vite.config.ts property, it should work correctly. Actually, they work well in my environment after updating @hono/vite-dev-server to 0.13.0.

If you provide a minimal project to reproduce it, I can investigate it!

stordahl commented 2 weeks ago

Also experiencing this in a new Hono app - downgrading @hono/vite-dev-server to 0.11.1 fixed it

tomByrer commented 2 weeks ago

If you provide a minimal project to reproduce it, I can investigate it

I already did in OP:

Steps: git clone https://github.com/yusukebe/url-shortener

yusukebe commented 2 weeks ago

Ah, I might find the cause. I'll investigate it.

yusukebe commented 2 weeks ago

Hey, you all.

That was a bug. I've fixed and released the new version 0.13.1, which includes the fix. Try it.

tomByrer commented 2 weeks ago

Thanks @yusukebe, I upgraded all deps in MY private repo; everything works!

Didn't work in your url-shortener repo though :/