parcel build: Zero-Config Production Builds
parcel build compiles and optimizes your app for production with minification and hashing, no config required.
Parcel targets zero-config. In CI you point it at an entry, choose the output directory and public URL, and it produces optimized assets.
What it does
parcel build runs a production build: it resolves the dependency graph from the entry, transpiles, minifies, hashes filenames, and writes to dist. It uses a persistent cache in .parcel-cache to speed later builds.
Common usage
parcel build src/index.html
parcel build src/index.html --dist-dir build --public-url /app/
# disable the cache when a corrupt cache causes flakiness
parcel build src/index.html --no-cacheOptions
| Flag | What it does |
|---|---|
| --dist-dir <dir> | Output directory (default dist) |
| --public-url <url> | Base URL that assets are served from |
| --no-source-maps | Skip source map generation |
| --no-cache | Disable the persistent cache |
| --no-optimize | Skip minification/optimization |
| --target <name> | Build only the named target from package.json |
In CI
Cache the .parcel-cache directory to keep builds fast, but drop it with --no-cache if you hit a stale-cache bug. Set --public-url to match where the app is deployed or asset links break in production.
Common errors in CI
"@parcel/resolver-default: Cannot resolve module \"X\"" means a missing dependency or a bad import path. "Failed to deserialize" or odd incremental errors point at a corrupt .parcel-cache; re-run with --no-cache. A build that works locally but 404s assets in prod usually has the wrong --public-url.