honojs/vite-plugins

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

Closed this issue ยท 7 comments

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

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.

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!

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

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

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

Hey, you all.

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

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

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