Open lane711 opened 11 months ago
I somewhat fixed this if I run the commands not together, but I can't figure out why it doesn't work when I put everything in the package.json
The steps are the following (the code is here btw)
watch.mjs
where I use the context
function. This will build the dist/_worker.js
every time the server.ts
and it's child has a changedev:esbuild
task to run the previous step and on the dev:wrangler
I just inserted the --live-reload
option that refreshs the tab every time the dist/_worker.js
is updated. If you ran this commands in separated tabs it's works as intended, but when you try to run inside the package.json
I get the error ERR_IPC_CHANNEL_CLOSED
and I can't figure why.
I'd appreciate some help to solve this.
Here's the error code in fully formed:
/Users/rhamses/Sites/sonicjs/node_modules/wrangler/wrangler-dist/cli.js:30947
throw a;
^
Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
at new NodeError (node:internal/errors:405:5)
at target.send (node:internal/child_process:754:16)
at Object.announceAndOnReady [as onReady] (/Users/rhamses/Sites/sonicjs/node_modules/wrangler/wrangler-dist/cli.js:150985:15)
at MiniflareServer.<anonymous> (/Users/rhamses/Sites/sonicjs/node_modules/wrangler/wrangler-dist/cli.js:128314:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on process instance at:
at process.processEmit [as emit] (/Users/rhamses/Sites/sonicjs/node_modules/wrangler/wrangler-dist/cli.js:25324:38)
at node:internal/child_process:758:35
at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
code: 'ERR_IPC_CHANNEL_CLOSED'
}
Can we use Hono's new Cloudflare Pages template?
We are thinking that if we can run it with only Vite and Hono, without relying on Wrangler, it would give us a lot of flexibility.
However, when I tried it at hand, it did not work well...(seems to be a problem with loki and other processes?)
https://github.com/honojs/hono/releases/tag/v3.9.0
import { defineConfig } from 'vite'
import devServer from '@hono/vite-dev-server'
import pages from '@hono/vite-cloudflare-pages'
export default defineConfig({
plugins: [
pages(),
devServer({
entry: 'src/index.tsx'
})
]
})
live reload was working prior to this commit: 26bb2ac4f0668fc7f0d38ddd898e84dd772bc522 dev build 26bb2ac4 Lane ldc0618@gmail.com Aug 22, 2023 at 8:48 AM
I had to convert the esbuild to use a config file.
Since then live reload with wranger has not worked. for reference here is the commands involved: npm run dev "dev": "run-p dev:*", "dev:wrangler": "wrangler pages dev dist --live-reload", "dev:esbuild": "node ./src/cms/util/build.mjs",
The goal is to restore live reload so that anytime a tsx, js, css, etc file is changed, it will build, copy to the dist folder and restart the server.