Callback postprocess
Option: postprocess
Type:
type postprocess = (
content: string,
info: TemplateInfo,
compilation: Compilation
) => string | undefined;
type TemplateInfo = {
name: string;
assetFile: string;
sourceFile: string;
resource: string;
outputPath: string;
};
Default: null
Called after the template has been compiled, but not yet finalized, before injection of the split chunks and inline assets.
The postprocess have the following arguments:
content: string- a content of processed fileinfo: TemplateInfo- info about current filecompilation: Compilation- the Webpack compilation object
The TemplateInfo have the following properties:
name: string- the entry nameassetFile: string- the output asset filename relative tooutputPathsourceFile: string- the absolute path of the source file, without a queryresource: string- the absolute path of the source file, including a queryoutputPath: string- the absolute path of the output directory
Return new content as a string.
If return undefined, the result processed via Webpack plugin is ignored and will be saved a result processed via the loader.