@@ -45,19 +45,6 @@ See [🛠 Builds](/builds.html) for more details.
4545:::
4646<!-- prettier-ignore-end-->
4747
48- <!-- prettier-ignore-start-->
49- ::: warning
50- [ 📚 Modules] ( /modules.html ) support currently requires the
51- ` --experimental-vm-modules ` flag. This is enabled by default, but requires the
52- ` -S ` flag of ` /usr/bin/env ` . If your operating system doesn't support the ` -S `
53- flag (e.g. Ubuntu 18.04), you can run the following instead:
54-
55- ``` shell
56- $ node --experimental-vm-modules ./node_modules/.bin/miniflare worker.js
57- ```
58- :::
59- <!-- prettier-ignore-end-->
60-
6148### Watching and Debugging
6249
6350Add ` --watch ` /` -w ` and ` --debug ` /` -d ` flags to reload the worker whenever
@@ -70,16 +57,16 @@ $ miniflare worker.js --watch --debug
7057[mf:dbg] - Scripts: worker.js
7158[mf:dbg] Reloading worker.js...
7259[mf:inf] Worker reloaded!
73- [mf:dbg] Watching .env, worker.js, wrangler.toml...
60+ [mf:dbg] Watching .env, package.json, worker.js, wrangler.toml...
7461[mf:inf] Listening on :8787
7562[mf:inf] - http://127.0.0.1:8787
7663```
7764
7865### Configuration Autoloading
7966
80- Note that ` .env ` and ` wrangler.toml ` files are also being watched. These files
81- are always loaded automatically and configure your worker's environment in
82- addition to the CLI flags. See the
67+ Note that ` .env ` , ` package.json ` and ` wrangler.toml ` files are also being
68+ watched. These files are always loaded automatically and configure your worker's
69+ environment in addition to the CLI flags. See the
8370[ Wrangler Configuration] ( #wrangler-configuration ) reference below for more
8471details, but as an example, with the following ` wrangler.toml ` file and
8572` worker.js ` files:
@@ -106,14 +93,34 @@ $ miniflare worker.js --wrangler-config wrangler.other.toml
10693### Script Requirement
10794
10895The only required option is the script to run. This can either be passed as a
109- command line argument as we've been doing so far, or in a ` wrangler.toml ` file:
96+ command line argument as we've been doing so far, in a ` wrangler.toml ` file or
97+ in a ` package.json ` file. The command line argument takes priority, then the
98+ script in ` wrangler.toml ` , then the ` main ` or ` module ` field in ` package.json `
99+ (depending on whether ` modules ` support is enabled):
110100
111101``` toml
102+ # wrangler.toml
112103[build .upload ]
113104dir = " " # Defaults to "dist"
114105main = " ./worker.js"
115106```
116107
108+ ``` json
109+ // package.json
110+ {
111+ "main" : " worker.js" , // "service-worker" format
112+ "module" : " worker.mjs" // "modules" format
113+ }
114+ ```
115+
116+ ### Update Checker
117+
118+ The CLI includes an automatic update checker that looks for new versions of
119+ Miniflare once a day. As Cloudflare are always improving and tweaking workers,
120+ you should aim to install these promptly for improved compatibility with the
121+ real workers environment. You can disable this with the ` --disable-updater `
122+ flag.
123+
117124## Reference
118125
119126### Flags
@@ -129,6 +136,7 @@ Options:
129136 -d, --debug Log debug messages [boolean]
130137 -c, --wrangler-config Path to wrangler.toml [string]
131138 --wrangler-env Environment in wrangler.toml to use [string]
139+ --package Path to package.json [string]
132140 -m, --modules Enable modules [boolean]
133141 --modules-rule Modules import rule (TYPE=GLOB) [array]
134142 --build-command Command to build project [string]
@@ -149,6 +157,7 @@ Options:
149157 -e, --env Path to .env file [string]
150158 -b, --binding Bind variable/secret (KEY=VALUE) [array]
151159 --wasm WASM module to bind (NAME=PATH) [array]
160+ --disable-updater Disable update checker [boolean]
152161```
153162
154163### Wrangler Configuration
0 commit comments