Packager

A plugin type: Turn a group of assets into a bundle file

Packagers determine how to merge different asset types into a single bundle.

import { Packager } from "@parcel/plugin";

export default new Packager({
async package({ bundle }) {
// ...
return { contents, map };
},
});

ΒΆ Relevant API

Packager website/generate-api-docs/example.flow:1079

type PackagerΒ = {|
  package({|
    bundle: NamedBundle,
    bundleGraph: BundleGraph<NamedBundle>,
    options: PluginOptions,
    logger: PluginLogger,
    getInlineBundleContents: (Bundle, BundleGraph<NamedBundle>) => Async<{|
      contents: Blob
    |}>,
    getSourceMapReference: (map: ?SourceMap) => Async<?string>,
  |}): Async<BundleResult>,
|}