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:1169
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, ExportSymbolResolutionExportSymbolResolution parcel/packages/core/types/index.js:1183
type ExportSymbolResolutionΒ = {|
...SymbolResolution,
+exportAs: Symbol | string,
|}
Referenced by:
BundleGraphPackager parcel/packages/core/types/index.js:1549
type Packager<ConfigType>Β = {|
loadConfig?: ({|
config: Config,
options: PluginOptions,
logger: PluginLogger,
|}) => Promise<ConfigType> | ConfigType,
package({|
bundle: NamedBundle,
bundleGraph: BundleGraph<NamedBundle>,
options: PluginOptions,
logger: PluginLogger,
config: ConfigType,
getInlineBundleContents: (Bundle, BundleGraph<NamedBundle>) => Async<{|
contents: Blob
|}>,
getSourceMapReference: (map: ?SourceMap) => Async<?string>,
|}): Async<BundleResult>,
|}