-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(wrangler): Fix
pages dev
watch mode [Functions] (#6022)
The watch mode in `pages dev` for Pages Functions projects is currently partially broken, as it only watches for file system changes in the "/functions" directory, but not for changes in any of the Functions' dependencies. This means that given a Pages Function "math-is-fun.ts", defined as follows: ``` import { ADD } from "../math/add"; export async function onRequest() { return new Response(`${ADD} is fun!`); } ``` `pages dev` will reload for any changes in "math-is-fun.ts" itself, but not for any changes in "math/add.ts", which is its dependency. Similarly, `pages dev` will not reload for any changes in non-JS module imports, such as wasm/html/binary module imports. This commit fixes all these things, plus adds some extra polish to the `pages dev` watch mode experience. Fixes #3840
- Loading branch information
1 parent
4cdad9b
commit 7951815
Showing
5 changed files
with
401 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
fix: Fix `pages dev` watch mode [Functions] | ||
|
||
The watch mode in `pages dev` for Pages Functions projects is currently partially broken, as it only watches for file system changes in the | ||
"/functions" directory, but not for changes in any of the Functions' dependencies. This means that given a Pages Function `math-is-fun.ts`, defined as follows: | ||
|
||
``` | ||
import { ADD } from "../math/add"; | ||
export async function onRequest() { | ||
return new Response(`${ADD} is fun!`); | ||
} | ||
``` | ||
|
||
`pages dev` will reload for any changes in `math-is-fun.ts` itself, but not for any changes in `math/add.ts`, which is its dependency. | ||
|
||
Similarly, `pages dev` will not reload for any changes in non-JS module imports, such as wasm/html/binary module imports. | ||
|
||
This commit fixes all these things, plus adds some extra polish to the `pages dev` watch mode experience. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.