speed-measure-webpack-plugin

WebJar for speed-measure-webpack-plugin

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

speed-measure-webpack-plugin
Last Version

Last Version

1.3.3
Release Date

Release Date

Type

Type

jar
Description

Description

speed-measure-webpack-plugin
WebJar for speed-measure-webpack-plugin
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/stephencookdev/speed-measure-webpack-plugin

Download speed-measure-webpack-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/speed-measure-webpack-plugin/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>speed-measure-webpack-plugin</artifactId>
    <version>1.3.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/speed-measure-webpack-plugin/
implementation 'org.webjars.npm:speed-measure-webpack-plugin:1.3.3'
// https://jarcasting.com/artifacts/org.webjars.npm/speed-measure-webpack-plugin/
implementation ("org.webjars.npm:speed-measure-webpack-plugin:1.3.3")
'org.webjars.npm:speed-measure-webpack-plugin:jar:1.3.3'
<dependency org="org.webjars.npm" name="speed-measure-webpack-plugin" rev="1.3.3">
  <artifact name="speed-measure-webpack-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='speed-measure-webpack-plugin', version='1.3.3')
)
libraryDependencies += "org.webjars.npm" % "speed-measure-webpack-plugin" % "1.3.3"
[org.webjars.npm/speed-measure-webpack-plugin "1.3.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : chalk jar [2.0.1,3)

Project Modules

There are no modules declared in this project.

Speed Measure Plugin
(for webpack)


The first step to optimising your webpack build speed, is to know where to focus your attention.

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

Preview of Speed Measure Plugin's output

Install

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

or

yarn add -D speed-measure-webpack-plugin

Requirements

SMP requires at least Node v6. But otherwise, accepts all webpack versions (1, 2, 3, and 4).

Usage

Change your webpack config from

const webpackConfig = {
  plugins: [
    new MyPlugin(),
    new MyOtherPlugin()
  ]
}

to

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

const smp = new SpeedMeasurePlugin();

const webpackConfig = smp.wrap({
  plugins: [
    new MyPlugin(),
    new MyOtherPlugin()
  ]
});

and you're done! SMP will now be printing timing output to the console by default.

Check out the examples folder for some more examples.

Options

Pass these into the constructor, as an object:

const smp = new SpeedMeasurePlugin(options);

options.disable

Type: Boolean
Default: false

If truthy, this plugin does nothing at all.

{ disable: !process.env.MEASURE } allows opt-in measurements with MEASURE=true npm run build.

options.outputFormat

Type: String|Function
Default: "human"

Determines in what format this plugin prints its measurements

  • "json" - produces a JSON blob
  • "human" - produces a human readable output
  • "humanVerbose" - produces a more verbose version of the human readable output
  • If a function, it will call the function with the JSON blob, and output the response

options.outputTarget

Type: String|Function
Default: console.log

  • If a string, it specifies the path to a file to output to.
  • If a function, it will call the function with the output as the first parameter

options.pluginNames

Type: Object
Default: {}

By default, SMP derives plugin names through plugin.constructor.name. For some plugins this doesn't work (or you may want to override this default). This option takes an object of pluginName: PluginConstructor, e.g.

const uglify = new UglifyJSPlugin();
const smp = new SpeedMeasurePlugin({
  pluginNames: {
    customUglifyName: uglify
  }
});

const webpackConfig = smp.wrap({
  plugins: [
    uglify
  ]
});

options.granularLoaderData (experimental)

Type: Boolean
Default: false

By default, SMP measures loaders in groups. If truthy, this plugin will give per-loader timing information.

This flag is experimental. Some loaders will have inaccurate results:

  • loaders using separate processes (e.g. thread-loader)
  • loaders emitting file output (e.g. file-loader)

We will find solutions to these issues before removing the (experimental) flag on this option.

FAQ

What does general output time mean?

This tends to be down to webpack reading in from the file-system, but in general it's anything outside of what SMP can actually measure.

What does modules without loaders mean?

It means vanilla JS files, which webpack can handle out of the box.

Contributing

Contributors are welcome! 😊

Please check out the CONTRIBUTING.md.

Migrating

SMP follows semver. If upgrading a major version, you can consult the migration guide.

License

MIT

Versions

Version
1.3.3