Commands and Options
To list available commands type:
npx wmr --help
This will output all options that apply to all commands:
Usage
$ wmr <command> [options]
Available Commands
build make a production build
serve Start a production server
start Start a development server
For more info, run any command with the `--help` flag
$ wmr build --help
$ wmr serve --help
Options
--cwd The working directory - equivalent to "(cd FOO && wmr)"
--debug Print internal debugging messages to the console. Same as setting DEBUG=true
-v, --version Displays current version
-h, --help Displays this message
# Start
The start
command fires up a development server. In addition to serving your files, it watches for changes to those files, passes them through WMR's plugin system and applies the result in your browser. It's the main mode of WMR where you'll spend most of your time in.
To list additional command line options available in this mode, enter:
npx wmr start --help
List of additional options:
# --port, -p
- Type:
number
- Default:
8080
The port to start the development server on. To run the server on port 3000 use: wmr --port 3000
.
# --host
- Type:
string
- Default:
localhost
The hostname to listen on. The default is localhost
, meaning your app will be accessible on that machine under http://localhost:8080/
.
To allow other machines to access the development server use --host 0.0.0.0
. This will make the server discoverable publicly for everyone.
Important: Only the
Network:
address is accessible to others. TheLocal:
address is still private to you.
# --http2
- Type:
boolean
- Default:
false
Use HTTP/2 instead of HTTP/1.
# --compress
- Type:
boolean
- Default:
true
Enable compression when serving responses.
# --reload
- Type:
boolean
- Default:
false
Disable HMR (=hot module reloading) and always do a full page reload when applying updates in the browser.
# Build
The build
command generates a production build of your application. It enables additional minification plugins that work hard to make your application as small as possible.
To list additional command line options available in this mode, enter:
npx wmr build --help
# --public
- Type:
string
- Default:
public/
Your web app's root directory for source files.
# --out
- Type:
string
- Default:
dist/
The folder to store the generated files after a successful build.
# --prerender
- Type:
boolean
- Default:
false
Generate static HTML from all pages of your app. See the Prerendering chapter for more information.
# --sourcemap
- Type:
boolean
- Default:
false
Generate Source Map files.
# --visualize
- Type:
boolean
- Default:
false
Launch an interactive bundle visualizer to inspect which libraries were included in your bundles. This is commonly used to get a picture of the cost of certain libraries and find areas for size improvements.
# --minify
- Type:
boolean
- Default:
true
Enable minification of the code generated by WMR.
# --cwd
- Type:
string
- Default:
.
The path to where WMR was launched from. Used to look up package.json
. Equivalent to (cd FOO && wmr build)
.
# --debug
If this flag is passed, print internal debugging messages to the console. Same as setting the environment variable DEBUG=true
.
# Serve
The serve
command starts a production web server using the files generated by the build
command. Unlike the development server, this serve
doesn't support any form of HMR. It's mainly useful for performance testing and ensuring prerendering is working optimally.
This command supports the same options as the start
command.