A Webpack plugin that allows transforming/modifying assets just before Webpack emits them. Version 3.0.0 supports Webpack 4+, while v2.1.2 is for Webpack 3 and below. The plugin accepts an array of asset processors, each with a regex to match asset names and a processor function returning a Promise. It provides an assets object for adding, deleting, or retrieving assets during processing. Useful for prefixing comments, running final optimizations (e.g., cssnano), or generating additional assets like source maps. Compared to other asset modification plugins, it offers explicit per-processor phase control and direct asset manipulation.
npm install last-call-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Shows typical usage with two processors: one to prepend a comment to JS files, another to minify CSS files using cssnano.
Downgrade to last-call-webpack-plugin@2.1.2 if using Webpack < 4.
Consider using 'compilation.optimize-assets' or 'emit' phase instead.
Ensure processor returns a Promise or use async/await. For synchronous transforms, wrap in Promise.resolve().
Use getAsset() to check existence before deleting, or catch errors.
Use require('last-call-webpack-plugin') instead of import.Match plugin version to Webpack version: v2 for Webpack 3, v3 for Webpack 4+.
Check if asset.source exists, or use asset.buffer()/asset.content() depending on Webpack version.
No dependency data recorded yet.