Socket
Socket
Sign inDemoInstall

speed-measure-webpack-plugin

Package Overview
Dependencies
309
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    speed-measure-webpack-plugin

A Webpack plugin, to help measure the speed of your other loaders and plugins


Version published
Weekly downloads
773K
decreased by-1.24%
Maintainers
1
Install size
106 kB
Created
Weekly downloads
 

Readme

Source

Speed Measure Plugin


This plugin measures your webpack build speed, giving an output like this:

Preview of Speed Measure Plugin's output

Getting Started

npm install --save speed-measure-webpack-plugin

Change your webpack config from

{
  entry: {/*...*/},
  output: {/*...*/},
  module: {/*...*/},
  plugins: [
    new MyPlugin(),
    new MyOtherPlugin()
  ]
}

to

const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");

{
  entry: {/*...*/},
  output: {/*...*/},
  module: {/*...*/},
  plugins: SpeedMeasurePlugin.wrapPlugins({
    MyPlugin: new MyPlugin(),
    MyOtherPlugin: new MyOtherPlugin()
  })
}

Or you can also specify config:

const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");

{
  entry: {/*...*/},
  output: {/*...*/},
  module: {/*...*/},
  plugins: SpeedMeasurePlugin.wrapPlugins({
    MyPlugin: new MyPlugin(),
    MyOtherPlugin: new MyOtherPlugin()
  }, {
    outputFormat: "human",
    outputTarget: "myFile.txt"
  })
}

If you're using webpack-merge, then you can do:

// base config file
const smp = new SpeedMeasurePlugin({
  outputFormat: "human"
});

const finalConfig = webpackMerge(
  [baseConfig, envSpecificConfig].map(configGenerator =>
    configGenerator({
      smp,
      // other options
    })
  )
);

// baseConfig
export const baseConfig = ({ smp }) => ({
  plugins: smp.wrapPlugins({
    MyPlugin: new MyPlugin()
  }).concat(smp)
})

// envSpecificConfig
export const envSpecificConfig = ({ smp }) => ({
  plugins: smp.wrapPlugins({
    MyOtherPlugin: new MyOtherPlugin()
  })
})

outputFormat

(default "json")

  • "json" - produces a JSON blob
  • "human" - produces a human readable output

outputTarget

(default null)

  • null - prints to console.log
  • "foo" - prints (and makes, if no file exists) to the file at location "foo"

disable

(default null)

If truthy, this plugin does nothing at all (recommended by default)

FAQs

Last updated on 02 Feb 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc