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

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

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

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

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