Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(options) {
super({
assetProcessors: [
{
phase: LastCallWebpackPlugin.PHASES.OPTIMIZE_CHUNK_ASSETS,
regExp: (options && options.assetNameRegExp) || /\.css(\?.*)?$/i,
processor: (assetName, asset, assets) =>
this.processCss(assetName, asset, assets),
}
],
canPrint: options && options.canPrint,
});
this.options.assetNameRegExp = !options || !options.assetNameRegExp ?
/\.css(\?.*)?$/i :
options.assetNameRegExp;
this.options.cssProcessor = !options || !options.cssProcessor ?
require('cssnano') :
options.cssProcessor;
this.options.cssProcessorOptions = !options || options.cssProcessorOptions === undefined ?
{} :
apply(compiler) {
const lastCallInstance = new LastCallWebpackPlugin({
assetProcessors: [
{
phase: LastCallWebpackPlugin.PHASES.OPTIMIZE_CHUNK_ASSETS,
regExp: /\.css$/g,
processor: (assetName, asset, assets) => this.processCss(assetName, asset, assets),
},
],
canPrint: true,
});
return lastCallInstance.apply(compiler);
}