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.html
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
The watch
command is similar to serve
, with the main difference being it doesn't start up a server.
parcel watch index.html
Displays all possible cli options
parcel help
Displays Parcel version number
parcel --version
Default: "dist"
Available in: serve
, watch
, build
parcel build entry.js --out-dir build/output
# or
parcel build entry.js -d build/output
root
- build
- - output
- - - entry.js
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>
Default: browser
Available in: serve
, watch
, build
parcel build entry.js --target node
node
and electron
will not bundle package.json's dependencies
(but will include devDependencies
). This behavior can be overriden using --bundle-node-modules flag (see below).
Possible targets: node
, browser
, electron
Default: false
Available in: serve
, watch
, build
parcel build entry.js --target node --bundle-node-modules
By default, package.json's dependencies
are not included when using --target node
or --target electron
. This flag adds them to the bundle.
Default: ".cache"
Available in: serve
, watch
, build
parcel build entry.js --cache-dir build/cache
Default: 1234
Available in: serve
parcel serve entry.js --port 1111
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 everything |
4 | Verbose (keep everything in log with timestamps) |
5 | Debug (save everything to a file with timestamps) |
Default: location.hostname
of current window
Available in: serve
, watch
parcel entry.js --hmr-hostname parceljs.org
Default: A random available port
Available in: serve
, watch
parcel entry.js --hmr-port 8080
Default: Original filename
Available in: serve
, watch
, build
parcel build entry.js --out-file output.html
This changes the output filename of the entrypoint bundle
Default: Minimal report
Available in: build
parcel build entry.js --detailed-report
Default: https disabled
Available in: serve
, watch
(listen on HTTPS for HMR connections)
parcel build entry.js --https
Default: https disabled
Available in: serve
, watch
parcel entry.js --cert certificate.cert --key private.key
Default: open disabled
Available in: serve
parcel entry.js --open
Default: source-maps enabled
Available in: serve
, watch
, build
parcel build entry.js --no-source-maps
Default: autoinstall enabled
Available in: serve
, watch
parcel entry.js --no-autoinstall
Default: HMR enabled
Available in: serve
, watch
parcel entry.js --no-hmr
Default: minification enabled
Available in: build
parcel build entry.js --no-minify
Default: cache enabled
Available in: serve
, watch
, build
parcel build entry.js --no-cache
Default: disabled
Available in: serve
, watch
, build
parcel serve entry.js --global myvariable
Default: disabled
Available in: build
parcel build entry.js --experimental-scope-hoisting
For more information, see the Tree Shaking section of Devon Govett's post on Parcel 1.9.