|
| 1 | +# Speed Measure Webpack Plugin |
| 2 | + |
| 3 | +**_(this plugin is not yet stable, and not safe for production)_** |
| 4 | + |
| 5 | +**_(so far tested only with webpack@3.10.0, node@8.9.4)_** |
| 6 | + |
| 7 | +This plugin measures your webpack build speed, giving an output like this: |
| 8 | + |
| 9 | +``` |
| 10 | +---------------------------- |
| 11 | +General output time took 1.01 minutes |
| 12 | +
|
| 13 | +IgnorePlugin took 0.62 seconds |
| 14 | +ForceCaseSensitivityPlugin took 20.27 seconds |
| 15 | +SpriteLoaderPlugin took 30 milliseconds |
| 16 | +ExtractTextPlugin took 9.44 seconds |
| 17 | +DefinePlugin took 1 milliseconds |
| 18 | +
|
| 19 | +thread-loader, and |
| 20 | +babel-loader took 0.56 minutes |
| 21 | + Med = 401 milliseconds, |
| 22 | + x̄ = 1.08 seconds, |
| 23 | + σ = 0.57 seconds, |
| 24 | + range = (268 milliseconds, 2.49 seconds), |
| 25 | + n = 247 |
| 26 | +file-loader took 7.11 seconds |
| 27 | + Med = 1.41 seconds, |
| 28 | + x̄ = 1.26 seconds, |
| 29 | + σ = 436 milliseconds, |
| 30 | + range = (340 milliseconds, 2.02 seconds), |
| 31 | + n = 29 |
| 32 | +---------------------------- |
| 33 | +``` |
| 34 | + |
| 35 | +# Getting Started |
| 36 | + |
| 37 | +`npm install --save-dev speed-measure-webpack-plugin` |
| 38 | + |
| 39 | +Change your webpack config from |
| 40 | + |
| 41 | +``` |
| 42 | +{ |
| 43 | + entry: {...}, |
| 44 | + output: {...}, |
| 45 | + module: {...}, |
| 46 | + plugins: [ |
| 47 | + new MyPlugin(), |
| 48 | + new MyOtherPlugin() |
| 49 | + ] |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +to |
| 54 | + |
| 55 | +``` |
| 56 | +{ |
| 57 | + entry: {...}, |
| 58 | + output: {...}, |
| 59 | + module: {...}, |
| 60 | + plugins: SpeedMeasurePlugin.wrapPlugins({ |
| 61 | + MyPlugin: new MyPlugin(), |
| 62 | + MyOtherPlugin: new MyOtherPlugin() |
| 63 | + }) |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +Or you can also specify config: |
| 68 | + |
| 69 | +``` |
| 70 | +{ |
| 71 | + entry: {...}, |
| 72 | + output: {...}, |
| 73 | + module: {...}, |
| 74 | + plugins: SpeedMeasurePlugin.wrapPlugins({ |
| 75 | + MyPlugin: new MyPlugin(), |
| 76 | + MyOtherPlugin: new MyOtherPlugin() |
| 77 | + }, { |
| 78 | + outputFormat: "human", |
| 79 | + outputTarget: "myFile.txt" |
| 80 | + }) |
| 81 | +} |
| 82 | +``` |
| 83 | + |
| 84 | +## `outputFormat` ## |
| 85 | + |
| 86 | +(default `"json"`) |
| 87 | + |
| 88 | + * `"json"` - produces a JSON blob |
| 89 | + * `"human"` - produces a human readable output |
| 90 | + |
| 91 | +## `outputTarget` ## |
| 92 | + |
| 93 | +(default `null`) |
| 94 | + |
| 95 | + * `null` - prints to `console.log` |
| 96 | + * `"foo"` - prints (and makes, if no file exists) to the file at location `"foo"` |
0 commit comments