Skip to content

x-basic-Template: How to enable hot reloading during preview? #86

Description

@johanndev

Hi!

When using the cloudflare-workers+vite template, I can augment the preview with the --live-reload script to get hot reloading of my changes:

"scripts": {
  "dev": "vite",
  "preview": "wrangler dev --live-reload",
  "deploy": "wrangler deploy"
},

When trying the same on the x-basic template, changes to my code are not hot-reloaded. I have to manually run the build script to get the new changes.

When I add a build section to my wrangler.jsonc:

"build": {
  "watch_dir": "./app",
  "command": "bun run build"
},

...the build script always runs twice*, leading to very long reload times.

What is the recommended configuration to get performant hot-reloading?

Thanks!

*I know that the honox build script calls vite twice (vite build --mode client && vite build), so configuring the build section as described above calls vite 4 times on changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions