Skip to content

Commit

Permalink
Unhide --live-reload and ensure only enabled in local mode (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbot committed Nov 18, 2022
1 parent 0492666 commit 8eb53b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-pigs-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Unhide `--live-reload` option for local mode development
1 change: 1 addition & 0 deletions packages/wrangler/src/__tests__/dev.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,7 @@ describe("wrangler dev", () => {
--node-compat Enable node.js compatibility [boolean]
--persist Enable persistence for local mode, using default path: .wrangler/state [boolean]
--persist-to Specify directory to use for local persistence (implies --persist) [string]
--live-reload Auto reload HTML pages when change is detected in local mode [boolean]
--test-scheduled Test scheduled events by visiting /__scheduled in browser [boolean] [default: false]
--log-level Specify logging level [choices: \\"debug\\", \\"info\\", \\"log\\", \\"warn\\", \\"error\\", \\"none\\"] [default: \\"log\\"]",
"warn": "",
Expand Down
15 changes: 12 additions & 3 deletions packages/wrangler/src/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,20 @@ export function devOptions(yargs: Argv<CommonYargsOptions>): Argv<DevArgs> {
requiresArg: true,
})
.option("live-reload", {
// TODO: Add back in once we have remote `--live-reload`
hidden: true,
// describe: "Auto reload HTML pages when change is detected",
describe:
"Auto reload HTML pages when change is detected in local mode",
type: "boolean",
})
.check((argv) => {
const local = argv["local"] || argv["experimental-local"];
if (argv["live-reload"] && !local) {
throw new Error(
"--live-reload is only supported in local mode. " +
"Please enable either --local or --experimental-local."
);
}
return true;
})
.option("inspect", {
describe: "Enable dev tools",
type: "boolean",
Expand Down

0 comments on commit 8eb53b1

Please sign in to comment.