Runtime

A plugin type: Programatically insert assets out of thin air into bundles

Runtimes accept a bundle and return assets to be inserted into that bundle.

import { Runtime } from "@parcel/runtime";

export default new Runtime({
async apply({ bundle, bundleGraph }) {
// ...
return assets;
},
});

ยถ Relevant API

RuntimeAsset website/generate-api-docs/example.flow:1057

A "synthetic" asset that will be inserted into the bundle graph.

type RuntimeAssetย = {|
  +filePath: FilePath,
  +code: string,
  +dependency?: Dependency,
  +isEntry?: boolean,
|}
Referenced by:
Runtime

Runtime website/generate-api-docs/example.flow:1067

type Runtimeย = {|
  apply({|
    bundle: NamedBundle,
    bundleGraph: BundleGraph<NamedBundle>,
    options: PluginOptions,
    logger: PluginLogger,
  |}): Async<void | RuntimeAsset | Array<RuntimeAsset>>,
|}