Optimizer
A plugin type: Apply modifications to the finished bundle
Optimizers are similar to transformers, but they accept a bundle instead of a single asset. At this stage, any ASTs have already been stringified.
import { Optimizer } from "@parcel/plugin";
export default new Optimizer({
  async optimize({ bundle, contents, map }) {
    let result = minifyCode(contents, map);
    return { contents: result.contents, map: result.contents };
  },
});ΒΆ Relevant API
Optimizer parcel/packages/core/types/index.js:1572
type Optimizer<ConfigType>Β = {|  loadConfig?: ({|
    config: Config,
    options: PluginOptions,
    logger: PluginLogger,
  |}) => Promise<ConfigType> | ConfigType,  optimize({|
    bundle: NamedBundle,
    bundleGraph: BundleGraph<NamedBundle>,
    contents: Blob,
    map: ?SourceMap,
    options: PluginOptions,
    logger: PluginLogger,
    config: ConfigType,
    getSourceMapReference: (map: ?SourceMap) => Async<?string>,
  |}): Async<BundleResult>,|}