Parcel Zero-config bundler
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
npm install -D parcel
npx parcel src/index.html
npx parcel build src/index.html
npx parcel watch src/index.js
npx parcel --port 3000
npx parcel build --dist-dir out
npx parcel build --public-url /app/
npx parcel build --no-cache
Concepts
- Entry index.html or source field
- Dev server localhost:1234, HMR
- dist/ minified, hashed files
- Watch rebuild, no HTTP server
Dev server
parcel <entry>
parcel serve <entry>
parcel --port <port>
parcel --host <host>
parcel --open [browser]
parcel --httpsparcel --cert <file> --key <file>
parcel --no-hmrparcel --lazyparcel --hmr-port <port>
parcel --no-autoinstall
Watch
parcel watch <entry>
parcel watch --no-hmr
parcel watch --watch-dir <dir>
parcel watch --watch-for-stdin
Build
parcel build <entry>
parcel build 'src/*.html'
parcel buildparcel build --no-optimize
parcel build --no-scope-hoist
parcel build --no-content-hash
parcel build --detailed-report [n]
parcel build --no-source-maps
Output and targets
--dist-dir <dir>
--public-url <url>
--target <name>
| Field | Purpose |
|---|---|
source |
Default entry file(s) |
main |
Library output path (CommonJS) |
module |
Library output path (ES module) |
browserslist |
Browsers to support |
targets |
Per-target dist, publicUrl, options |
Cache and diagnostics
--no-cache--cache-dir <path>
--log-level <level>
--config <path>
--reporter <pkg>
--profile--traceparcel --version
Config files
{ "extends": "@parcel/config-default", "transformers": { "*.svg": ["@parcel/transformer-svg-react"] }}
"source": "src/index.html","targets": { "default": { "distDir": "./public", "publicUrl": "/app" }}
Recipes
"scripts": { "start": "parcel src/index.html", "build": "parcel build src/index.html"}
rm -rf dist .parcel-cachenpx parcel build src/index.html \ --public-url /docs/ --dist-dir site
# package.json: "source", "main", "module"npx parcel watchnpx parcel build --no-optimize
npx parcel src/index.html --https --host 0.0.0.0



