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 serialized.
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 website/generate-api-docs/example.flow:1096
type OptimizerΒ = {|
optimize({|
bundle: NamedBundle,
contents: Blob,
map: ?SourceMap,
options: PluginOptions,
logger: PluginLogger,
getSourceMapReference: (map: ?SourceMap) => Async<?string>,
|}): Async<BundleResult>,
|}