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

SymbolResolution parcel/packages/core/types/index.js:825

Specifies a symbol in an asset

type SymbolResolutionย = {|
  +asset: Asset,
The Asset which exports the symbol.
  +exportSymbol: Symbol | string,
under which name the symbol is exported
  +symbol: void | null | Symbol,
The identifier under which the symbol can be referenced.
  +loc: ?SourceLocation,
The location of the last specifier that lead to this result.
|}
Referenced by:
BundleGraph, ExportSymbolResolution

ExportSymbolResolution parcel/packages/core/types/index.js:839

type ExportSymbolResolutionย = {|
  ...SymbolResolution,
  +exportAs: Symbol | string,
|}
Referenced by:
BundleGraph

Packager parcel/packages/core/types/index.js:1086

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>,
|}