✨ Production

When it comes time to bundle your application for production, you can use Parcel's production mode.

parcel build entry.js

This disables watch mode and hot module replacement so it will only build once. It also enables the minifier for all output bundles to reduce file size. The minifiers used by Parcel are uglify-es for JavaScript, cssnano for CSS, and htmlnano for HTML.

Enabling production mode also sets the NODE_ENV=production environment variable. Large libraries like React have development only debugging features which are disabled by setting this environment variable, which results in smaller and faster builds for production.

Options

Set the output directory

Default: "dist"

parcel build entry.js --out-dir build/output
or
parcel build entry.js -d build/output
root
- build
- - output
- - - entry.js

Set the public URL to serve on

Default: --out-dir option

parcel build entry.js --public-url ./

will output:

<link rel="stylesheet" type="text/css" href="1a2b3c4d.css">
or
<script src="e5f6g7h8.js"></script>

Disable minification

Default: minification enabled

parcel build entry.js --no-minify

Disable the filesystem cache

Default: cache enabled

parcel build entry.js --no-cache