🖥 CLI
Commands
Serve
Starts up a development server, which will automatically rebuild your app as you change files and supports hot module replacement for fast development.
parcel index.htmlYou may also pass a glob or list of globs for multiple entry points.
parcel one.html two.html
# OR
parcel *.html
# OR
parcel ./**/*.htmlBuild
Builds the assets once, it also enabled minification and sets the NODE_ENV=production environment variable. See Production for more details.
parcel build index.htmlNOTE: For special use cases, it's also possible to perform a single build from the development environment, like this:
NODE_ENV=development parcel build <entrypoint> --no-minifyIt creates the same bundles as serve, but it doesn't watch or serve assets.
Watch
The watch command is similar to serve, with the main difference being it doesn't start up a server.
parcel watch index.htmlHelp
Displays all possible cli options
parcel helpVersion
Displays Parcel version number
parcel --versionOptions
Output directory
Default: "dist"
Available in: serve, watch, build
parcel build entry.js --out-dir build/output
# or
parcel build entry.js -d build/outputroot
- build
- - output
- - - entry.jsSet the public URL to serve on
Default: "/"
Available in: serve, watch, build
parcel entry.js --public-url ./dist/will output:
<link rel="stylesheet" type="text/css" href="dist/entry.1a2b3c.css" />
<!-- or -->
<script src="dist/entry.e5f6g7.js"></script>Target
Default: browser
Available in: serve, watch, build
parcel build entry.js --target node⚠️ Target node and electron will not bundle package.json's dependencies. This behavior can be overriden using --bundle-node-modules flag (see below).
Possible targets: node, browser, electron
Force node modules bundling
Default: false
Available in: serve, watch, build
parcel build entry.js --target node --bundle-node-modulesBy default, package.json's dependencies are not included when using --target node or --target electron. This flag adds them to the bundle.
Cache directory
Default: ".cache"
Available in: serve, watch, build
parcel build entry.js --cache-dir build/cacheHost
Default: localhost
Available in: serve
parcel serve entry.js --host local.myhost.co.ukPort
Default: 1234
Available in: serve
parcel serve entry.js --port 1111Change Log level
Default: 3
Available in: serve, watch, build
parcel entry.js --log-level 1| Loglevel | Effect |
|---|---|
| 0 | Logging disabled |
| 1 | Only log errors |
| 2 | Log errors and warnings |
| 3 | Log errors, warnings and info |
| 4 | Verbose (keep everything in log with timestamps and also log http requests to dev server) |
| 5 | Debug (save everything to a file with timestamps) |
HMR Hostname
Default: location.hostname of current window
Available in: serve, watch
parcel entry.js --hmr-hostname parceljs.orgHMR Port
Default: A random available port
Available in: serve, watch
parcel entry.js --hmr-port 8080Output filename
Default: Original filename
Available in: serve, watch, build
parcel build entry.js --out-file output.htmlThis changes the output filename of the entrypoint bundle
Print a detailed report
Default: Minimal report, otherwise depth 10
The optional argument specifies the depth to print.
Available in: build
parcel build entry.js --detailed-report
parcel build entry.js --detailed-report 10Enable https
Default: https disabled
Available in: serve, watch (listen on HTTPS for HMR connections)
parcel build entry.js --https⚠️ This flag generates a self-signed certificate, you might have to configure your browser to allow self-signed certificates for localhost.
Set a custom certificate
Default: https disabled
Available in: serve, watch
parcel entry.js --cert certificate.cert --key private.keyOpen in browser
Default: open disabled
Available in: serve
parcel entry.js --openDisable source-maps
Default: source-maps enabled
Available in: serve, watch, build
parcel build entry.js --no-source-mapsDisable content hashing
Default: content-hash enabled
Available in: build
parcel build entry.js --no-content-hashDisable autoinstall
Default: autoinstall enabled
Available in: serve, watch
parcel entry.js --no-autoinstallDisable HMR
Default: HMR enabled
Available in: serve, watch
parcel entry.js --no-hmrDisable minification
Default: minification enabled
Available in: build
parcel build entry.js --no-minifyDisable the filesystem cache
Default: cache enabled
Available in: serve, watch, build
parcel build entry.js --no-cacheExpose modules as UMD
Default: disabled
Available in: serve, watch, build
parcel serve entry.js --global myvariableEnable experimental scope hoisting/tree shaking support
Default: disabled
Available in: build
parcel build entry.js --experimental-scope-hoistingFor more information, see the Tree Shaking section of Devon Govett's post on Parcel 1.9.
Help us improve the docs
If something is missing or not entirely clear, please file an issue on the website repository or edit this page.