Registry / devops / last-call-webpack-plugin

last-call-webpack-plugin

JSON →
library3.0.0jsnpmunverified

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-plugin
INSTALL
IMPORT
SIG · LAST-CALL-WEBPACK-
L
last-call-webpack-plugin
devopsjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LastCallWebpackPlugin
const LastCallWebpackPlugin = require('last-call-webpack-plugin');
import LastCallWebpackPlugin from 'last-call-webpack-plugin';
Package uses CommonJS export; ESM import may fail in Node without a bundler. Use require() in Webpack config.
LastCallWebpackPlugin (ESM)
import LastCallWebpackPlugin from 'last-call-webpack-plugin';
const { LastCallWebpackPlugin } = require('last-call-webpack-plugin');
If using ESM with bundler (e.g., Webpack itself), default import works. Do not destructure named export.
Constructor options
new LastCallWebpackPlugin({ assetProcessors: [...], canPrint: true })
new LastCallWebpackPlugin(assetProcessors: [...])
Options must be passed as an object with key 'assetProcessors'; the constructor expects an options object.

Shows typical usage with two processors: one to prepend a comment to JS files, another to minify CSS files using cssnano.

const LastCallWebpackPlugin = require('last-call-webpack-plugin'); const cssnano = require('cssnano'); module.exports = { entry: './src/index.js', output: { path: __dirname + '/dist', filename: 'bundle.js' }, plugins: [ new LastCallWebpackPlugin({ assetProcessors: [ { regExp: /\.js$/, processor: (assetName, asset) => Promise.resolve('// Author: John Doe\n' + asset.source()) }, { regExp: /\.css$/, processor: (assetName, asset, assets) => cssnano.process(asset.source()).then(r => r.css) } ], canPrint: true }) ] };
Debug
Known issues
breakingv3.0.0 requires Webpack 4 or higher; v2.x for Webpack 3 and below.
fix
Downgrade to last-call-webpack-plugin@2.1.2 if using Webpack < 4.
affects: >=3.0.0
deprecatedOption phase: 'compilation.optimize-chunk-assets' may be deprecated in Webpack 5.
fix
Consider using 'compilation.optimize-assets' or 'emit' phase instead.
affects: >=3.0.0
gotchaprocessor function must return a Promise or a value (if synchronous). Asynchronous behavior relies on Promise.
fix
Ensure processor returns a Promise or use async/await. For synchronous transforms, wrap in Promise.resolve().
affects: >=1.0.0
gotchaThe assets setAsset() method with null deletes the asset; does not provide feedback if asset missing.
fix
Use getAsset() to check existence before deleting, or catch errors.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: LastCallWebpackPlugin is not a constructor
Using ESM import syntax with CommonJS-only module.
fix
Use require('last-call-webpack-plugin') instead of import.
Error: webpack v4+ only supports last-call-webpack-plugin@3
Trying to use v2 with Webpack 4 or v3 with Webpack 3.
fix
Match plugin version to Webpack version: v2 for Webpack 3, v3 for Webpack 4+.
TypeError: asset.source is not a function
processor receives webpack asset object, which may not have source() in older webpack versions or custom asset types.
fix
Check if asset.source exists, or use asset.buffer()/asset.content() depending on Webpack version.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
last-call-webpack-plugin — npm install last-call-webpack-plugin · libregistry