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:886

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 | false | Symbol,
The identifier under which the symbol can be referenced.
  +loc: ?SourceLocation,
The location of the specifier that lead to this result.
|}
Referenced by:
BundleGraph, ExportSymbolResolution

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

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

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

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