home / skills / partme-ai / full-stack-skills / parcel

parcel skill

/skills/parcel

This skill provides quick, practical guidance for using the Parcel bundler, from zero-configuration setup to production builds.

npx playbooks add skill partme-ai/full-stack-skills --skill parcel

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
680 B
---
name: parcel
description: Provides comprehensive guidance for Parcel bundler including zero-configuration setup, asset handling, hot module replacement, and production builds. Use when the user asks about Parcel, needs to set up a build tool quickly, or work with Parcel's automatic configuration.
license: Complete terms in LICENSE.txt
---

## When to use this skill

Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]

## How to use this skill

[待完善:根据具体工具添加使用指南]

## Best Practices

[待完善:根据具体工具添加最佳实践]

## Keywords

[待完善:根据具体工具添加关键词]

Overview

This skill provides comprehensive, practical guidance for using the Parcel bundler. It covers zero-configuration setup, asset handling, hot module replacement, and production build optimizations. The guidance focuses on fast iteration, minimal config, and common troubleshooting. Use it to get a working Parcel build quickly or to improve an existing setup.

How this skill works

The skill inspects project needs and recommends the simplest Parcel workflow that meets them: zero-config for basic apps, project-level configuration for advanced cases, or plugin usage for custom asset handling. It explains how Parcel detects entry points, transforms assets, serves with HMR during development, and generates optimized bundles for production. It also outlines configuration file options, CLI commands, and common environment variables.

When to use it

  • You need a bundler that works out of the box for small to medium web apps.
  • You want fast developer feedback with hot module replacement and a dev server.
  • You need to bundle mixed assets (JS, CSS, images, fonts, HTML) with minimal config.
  • You want optimized production builds with code splitting and tree shaking without heavy setup.
  • You’re migrating from a complex webpack config and want simpler defaults.

Best practices

  • Start with Parcel’s zero-config by installing parcel and pointing the CLI to a single HTML or JS entry file.
  • Keep source file paths and imports explicit so Parcel can statically analyze dependencies for optimal bundling.
  • Use .parcelrc only when you need custom transformers or resolvers; prefer plugins over manual hacks.
  • Enable source maps in development and strip them in production builds for smaller output.
  • Use environment variables (process.env.NODE_ENV) to switch behavior between dev and prod and to enable minification.
  • Cache and clean: rely on Parcel’s cache for speed, but clear .parcel-cache when debugging strange build artifacts.

Example use cases

  • Create a quick prototype: npm init -y, install parcel, and run parcel index.html to get HMR and live reload.
  • Asset pipeline for static sites: import images and fonts directly in CSS/JS and let Parcel emit hashed output files.
  • Single-page app build: configure a single HTML entry and enable history fallback for client-side routing.
  • Library bundling: use Parcel’s targets field to produce ESM and CJS builds with minimal config.
  • Migrating from webpack: replicate essential loaders with Parcel plugins and remove complex config files.

FAQ

Do I always need a config file for Parcel?

No. Parcel is designed to work without a config for most projects. Add .parcelrc only for custom pipelines or to change default transformers.

How do I enable hot module replacement?

HMR is enabled by default when running parcel serve. Ensure your modules accept HMR updates (e.g., export/accept API) or rely on frameworks that handle it automatically.