Note: This page covers Parcel 1, the documentation for Parcel 2 is being worked on here:

📦 Packagers

In Parcel, a Packager combines multiple Assets together into a final output bundle. This happens in the main process after all assets have been processed, and a bundle tree has been created. Packagers are registered based on output file type, and assets that have generated that output type are sent to that packager for production of the final output file.

Packager Interface

const { Packager } = require('parcel-bundler')

class MyPackager extends Packager {
  async start() {
    // optional. write file header if needed.
    await this.dest.write(header)

  async addAsset(asset) {
    // required. write the asset to the output file.
    await this.dest.write(

  async end() {
    // optional. write file trailer if needed.
    await this.dest.end(trailer)

module.exports = MyPackager

Registering a Packager

You can register your packager with a bundler using the addPackager method. It accepts a file type to register, and the path to your packager module.

const Bundler = require('parcel-bundler')

let bundler = new Bundler('input.js')
bundler.addPackager('foo', require.resolve('./MyPackager'))

Help us improve the docs

If something is missing or not entirely clear, please file an issue on the website repository or edit this page.