⌨️ CLI

The "parcel" command

ΒΆ Commands

The "entries" in all commands can be:

If a glob pattern contains a wildcard * (or generally, is a glob), be sure to wrap the pattern in single quotes to ensure that the glob is not resolved by your shell and is passed to Parcel directly. This way, globs like ./**/* are resolved correctly and Parcel will also pick up newly created files without having to restart.

# βœ… Recommended
parcel './**/*.html'
parcel './img/**/*'

# ❌ Problematic
parcel ./**/*.html
parcel ./img/**/*

ΒΆ 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'

If you have specified multiple HTML entry points and none of them is has the output path /index.html, the dev server will respond to localhost:1234/ with a 404, since Parcel doesn't know which HTML bundle is the index.

In this case, load the file directly e.g. http://localhost:1234/a.html and http://localhost:1234/b.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 implicitly specify --no-scope-hoist).

ΒΆ Parameters

ΒΆ General parameters

Format Description
--cache-dir <path> Sets the cache directory. defaults to .parcel-cache
--dist-dir <dir> Output directory to write to when unspecified by targets.
Default value for targets.*.distDir
--log-level (none/error/warn/info/verbose) Sets the log level
--no-cache Disables reading from the filesystem cache
--no-source-maps Disables sourcemaps,
Overrides targets.*.sourceMap
--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
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)
--hmr-port <port> The port for the HMR server (defaults to the HTTP server's port)
--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
--no-autoinstall Disables autoinstall
--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 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