Skip to content

Commit

Permalink
docs(cloudflare): add local dev section (#1772)
Browse files Browse the repository at this point in the history
  • Loading branch information
McPizza0 authored Oct 3, 2023
1 parent b29f800 commit 2606a83
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/content/2.deploy/providers/cloudflare.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,25 @@ With `cloudflare_module` preset, you need to add the following rule to your `wra
[site]
bucket = ".output/public"
```

### Local Wrangler Dev builds

By default `wrangler dev` requires nitro to be built before it can be served by wrangler.

This can become tiresome if you're making changes to your nitro app and keep rebuilding to test changes in wrangler.

::alert{type="warning"}
This is a temporary workaround until nitro has better support for wrangler dev mode!
::

To instruct wrangler to automatically rebuild nitro when it detects file changes, you need to add the following rule to your `wrangler.toml` file:

```[wrangler.toml]
+ [env.development.build]
+ command = "NITRO_PRESET=cloudflare npm run build" // Replace npm with your packagemanager (npm, pnpm, yarn, bun)
+ cwd = "./"
+ watch_dir = ["./routes", "./nitro.config.ts"]
```

Now you need to run wrangler in development mode using `wrangler dev --env development`
When files change in nitro, wrangler will rebuild and serve the new files

0 comments on commit 2606a83

Please sign in to comment.