Skip to content

Commit 696d1a4

Browse files
Add in a disable flag
1 parent 4855317 commit 696d1a4

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ Or you can also specify config:
9292

9393
* `null` - prints to `console.log`
9494
* `"foo"` - prints (and makes, if no file exists) to the file at location `"foo"`
95+
96+
## `disable` ##
97+
98+
(default `null`)
99+
100+
If truthy, this plugin does nothing at all (recommended by default)

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module.exports = class SpeedMeasurePlugin {
2020
}
2121

2222
static wrapPlugins(plugins, options) {
23+
if (options.disable) return Object.keys(plugins).map(k => plugins[k]);
24+
2325
const smp = new SpeedMeasurePlugin(options);
2426

2527
if (Array.isArray(plugins)) {
@@ -82,6 +84,8 @@ module.exports = class SpeedMeasurePlugin {
8284
}
8385

8486
apply(compiler) {
87+
if (this.options.disable) return;
88+
8589
compiler.plugin("compile", () => {
8690
this.addTimeEvent("misc", "compile", "start", { watch: false });
8791
});

0 commit comments

Comments
 (0)