โจ๏ธ CLI
The "parcel" command
ยถ Commands
The "entries" in all commands can be:
- one or more files
- one or more globs
- one or more directorises (see Specifying Entrypoints)
ยถ parcel [serve] <entries>
Starts up a development server, which will automatically rebuild your app as you change files and supports hot module replacement. You may also pass a glob or list of globs for multiple entry points:
parcel index.html
parcel a.html b.html
parcel ./**/*.html
ยถ parcel watch <entries>
The watch command is similar to serve
, but only with a HMR server and no HTTP (dev) server.
parcel index.html
ยถ parcel build <entries>
Builds the assets once, it also enabled minification and sets the NODE_ENV=production environment variable. See Production for more details.
parcel build index.html
As opposed to serve
and watch
, build
has scope hoisting enabled by default (so the other commmands implicity specify --no-scope-hoist
).
ยถ Parameters
ยถ General parameters
Format | Description |
---|---|
--cache-dir <path> |
Sets the cache directory. defaults to .parcel-cache |
--log-level (none|error|warn|info|verbose) |
Sets the log level |
--no-autoinstall |
Disables autoinstall |
--no-cache |
Disables reading from the filesystem cache |
--no-source-maps |
Disables sourcemaps, Overrides targets.*.sourceMaps |
--profile |
Profiles the build (a flamechart can be generated) |
--public-url <url> |
The path prefix for absolute urls. Default value for targets.*.publicUrl |
--target [name] |
Only build the specified target(s) |
-V, --version |
Outputs the version number |
ยถ Parameters related to the dev server/watch mode (serve
and watch
)
Format | Description |
---|---|
--no-hmr |
Disables hot module replacement |
-p, --port <port> |
The port for the HMR and HTTP server (the default port is process.env.PORT or 1234) |
--host <host> |
Sets the host to listen on, defaults to listening on all interfaces |
--https |
Serves files over HTTPS |
--cert <path> |
Path to a certificate to use with HTTPS |
--key <path> |
Path to a private key to use with HTTPS |
--watch-for-stdin |
Stop Parcel once stdin is closed |
ยถ Parameters specific to serve
Format | Description |
---|---|
--open [browser] |
Automatically opens the entry in your browser, defaults to the default browser |
ยถ Parameters specific to the non-server commands (watch
and build
)
Format | Description |
---|---|
--dist-dir <dir> |
Output directory to write to when unspecified by targets. Default value for targets.*.distDir |
ยถ Parameters specific to build
Format | Description |
---|---|
--no-minify |
Disables minification (exact behaviour is determined by plugins). Related targets.*.minify |
--no-scope-hoist |
Disables scope hoisting. Related: targets.*.scopeHoist |
--detailed-report [depth] |
Displays the largest 10 (number configurable with depth ) assets per bundle in the CLI report |