Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

last-call-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

last-call-webpack-plugin

A Webpack plugin that allows to transform \ modify assets just before Webpack emits them.

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
decreased by-17.58%
Maintainers
1
Weekly downloads
 
Created

What is last-call-webpack-plugin?

The last-call-webpack-plugin is a Webpack plugin designed to optimize and manipulate assets at the last stage of the compilation process. It allows developers to perform transformations or optimizations on all assets right before Webpack emits them to the output directory. This can be particularly useful for tasks like minification, compression, or any other custom modifications that need to be applied after all other processing is complete.

What are last-call-webpack-plugin's main functionalities?

Asset Optimization

This feature allows the plugin to optimize JavaScript files by minifying them using UglifyJS right before the assets are emitted. The regular expression `/\.js(\.map)?$/` targets both JavaScript files and their source maps.

const LastCallWebpackPlugin = require('last-call-webpack-plugin');

module.exports = {
  plugins: [
    new LastCallWebpackPlugin({
      assetProcessors: [
        {
          regExp: /\.js(\.map)?$/,
          processor: (assetName, asset) => {
            return require('uglify-js').minify(asset.source()).code;
          }
        }
      ],
      canPrint: true
    })
  ]
};

Custom Asset Processing

This feature demonstrates how to use the plugin for custom processing of CSS files. It uses cssnano to optimize CSS files. The processor function is asynchronous, handling the promise returned by cssnano's `process` method.

const LastCallWebpackPlugin = require('last-call-webpack-plugin');

module.exports = {
  plugins: [
    new LastCallWebpackPlugin({
      assetProcessors: [
        {
          regExp: /\.css$/,
          processor: (assetName, asset) => {
            return require('cssnano').process(asset.source()).then(result => result.css);
          }
        }
      ],
      canPrint: false
    })
  ]
};

Other packages similar to last-call-webpack-plugin

Keywords

FAQs

Package last updated on 04 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc